PHP redirect with header(), search engine friendly?
I have a simple question about redirects using the php function header().
My project, I'm currently programming on is deployed on several domains, but with a common session and a single login authentication on one of the pages. I've written a solution using a global session server on开发者_StackOverflow社区 another domain, i.e. session.server.com. When a user visits one of the domains and is not authenticated yet (that means the local domain session is marked as not global), he will be redirected to the session server where a cookie is stored. The cookie-code is appended to the request and the user is being redirected back to the project's domain. For example:
1) User visits www.domaina.com/query
2) PHP checks the global session key and redirects to
3) session.domain.com, where a global session cookie is kept and
4) is being redirected back to www.domaina.com/_set_cookie/$SOMEENCODEDINFORMATION with the correct gloabl session data appended and encrypted in $SOMEENCODEDINFORMATION
5) The user is redirect to www.domaina.com/query. Now the script knows he is authenticated by the global session server
All the redirects are done via simple header("Location: ...")
calls in PHP.
This system works great and without any problem. But my main concern about this is the ranking in the search engines. What will a google (or any other bot) see when my page is crawled. Will it follow the header redirects until he's finally back on the main page? Or should i write a bot-filter in order not to make any redirect when a bot crawls my page?
Thank you for any propositions,
Greets from Germany, Andi
p.S. sorry, my english is not perfect, but I hope you know what I mean.
My understanding is that it is ok, if you are doing a 301 redirect.
Quick Google: 301 redirects
+1 for 301 redirects.
For future reference, I believe OAuth provides a safe way to share an account between domains (though I haven't actually used it). It's used by many companies in one way or another, including Twitter, Google, and Netflix.
精彩评论