MrFish Posted September 17, 2013 Share Posted September 17, 2013 I'm working on a site with an alias system that will redirect the browser to an aliased page if the non-aliased page is requested. So if you go to mysite.com/about.php it will redirect to mysite.com/about. I want to do this so google doesn't consider them 2 different pages (which it is now). Here is the redirect code- header("HTTP/1.1 301 Moved Permanently");header("location: $newURL");exit(); I thought if I changed the header to a 301 header google would know this was a mistake and the new url was the actual page. However this is not the case. So my question is- Does this header information ever get passed back to the browser? Does the browser do the redirect or does PHP redirect (and the browser just updates the address bar)? Do I need to change the status on the resulting page to 301 instead of 200? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 17, 2013 Share Posted September 17, 2013 The header function in PHP sends an HTTP header to the client. You can look up HTTP headers if you want to understand their role. The location header in this case tells the browser to request a different page. Link to comment Share on other sites More sharing options...
MrFish Posted September 17, 2013 Author Share Posted September 17, 2013 Ok. That answers my question. So If I send a redirect to the browser with a 301 status it should know that the page has moved and not count it as 2 unique pages. I'll need to check with our SEO guys but that makes sense to me. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now