Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEO and 301 redirects - Can they have relative paths or must they be absolute?

SEO and 301 redirects - Can they have relative paths or must they be absolute?

When doing a 301 redirect for a page, are the BOTs/Spiders going to treat a 301 that goes to a relative path (redirect="../") the same as one that goes to an absolute path (redirect="http://www.somewebsite.com/apage/").

For example I have a parent page with content (http://www.somewebsite.com/apage/) on it... I have a subpage (http://www.somewebsite.com/apage/more-details) with further content on it.

I plan to move the further content into the main page itself and get rid of the (http://www.somewebsite.com/apage/more-details), but I want to use a 301 to redirect bots/browsers to the page on level up (http://www.somewebsite.com/apage/) so I dont lose any page rank etc.

like image 378
fighella Avatar asked Oct 14 '09 04:10

fighella


1 Answers

Per The Standard, RFC 2616, "The [Location] field value consists of a single absolute URI." Using a relative URI in any "Location:" header (301 or otherwise) violates the standard and puts you at the mercy of strangers - the authors of browsers, spiders, etc. It's MUCH simpler, safer, and sounder, to follow the standard -- always use absolute URIs in your location headers!

like image 106
Alex Martelli Avatar answered Sep 20 '22 15:09

Alex Martelli