1

The standard redirect 301 template for htaccess is usually:

redirect 301 /folder_wrong/name.html http://website.com/folder-right/name.html

With the http website included

I'm wondering if the below would work WITHOUT the http website and only having the directory, because all I'm doing is transferring from one directory to another:

redirect 301 /folder_wrong/name.html /folder-right/name.html

That is fine right?

Megawatt
  • 165
  • 3
  • 13
  • [Possible related question](http://stackoverflow.com/questions/1564251/seo-and-301-redirects-can-they-have-relative-paths-or-must-they-be-absolute). – Mike Nov 18 '13 at 13:52
  • According to him it's much better not to use relative paths and use absolute redirect paths instead – Megawatt Nov 18 '13 at 14:10

1 Answers1

1

No, you have to use the full URL. See http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect.

As pointed out by Stijn in the comment below, you can specify the URL paths also starting from version 2.2.6.

You can use mod_rewrite if you need to overwrite only fragments of the URL.

Chandranshu
  • 3,669
  • 3
  • 20
  • 37
  • According to that link, you can from version 2.2.6 onwards. – user247702 Nov 18 '13 at 13:54
  • Thanks for pointing that out. I have not read the apache httpd documentation since I started using nginx. I just added the reference so that the OP can read the full documentation. – Chandranshu Nov 18 '13 at 13:56
  • Hi, what do you mean by version 2.2.6?! That just threw me off entirely, I checked the server details and it's using CGI instead of Apache, but I'm still able to use Redirect 301, so does that above still count for me or not? – Megawatt Nov 18 '13 at 14:07
  • You can use CGI along with Apache httpd server. CGI, as the name implies, is a gateway technology to execute code on the server. Some process on your machine still needs to listen to client requests and decide how to process them. That process is Apache httpd server. – Chandranshu Nov 18 '13 at 14:09
  • Well the server I'm using at the moment is only at version 2.0 so I guess that wouldn't work for me yet. According to this page: http://httpd.apache.org/download.cgi , 2.2.6 just came out today (legacy release). – Megawatt Nov 18 '13 at 14:17
  • Nope, the latest version is 2.4.6. 2.2.6 came out ages ago. – Chandranshu Nov 18 '13 at 14:18