10

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.

fighella
  • 580
  • 5
  • 16

1 Answers1

15

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!

Community
  • 1
  • 1
Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • 2
    Related (with a different answer): http://stackoverflow.com/questions/8250259/is-a-302-redirect-to-relative-url-valid-or-invalid – Alpha Jun 29 '12 at 21:35
  • 15
    RFC 2616 has been replaced with RFC 7231, which allows relative redirects. – alexloehr Oct 04 '16 at 15:16