redirect in .htaccess does not work

Alles, was den Apache betrifft, kann hier besprochen werden.

redirect in .htaccess does not work

Postby alanchcw » 18. September 2014 15:45

One site just linked to my website with incorrect URL as http://www.datanumen.com/aor/%e2%80%9d . I find this and want to correct this by redirecting the URL to http://www.datanumen.com/outlook-repair/ . Therefore, I add the following line in my .htaccess, as follows:

Redirect 301 /aor/%e2%80%9d http://www.datanumen.com/outlook-repair/

However, this does not work. When I input http://www.datanumen.com/aor/%e2%80%9d in FireFox or IE, the browser still said the page not found(404) error.

How to solve the problem?

Thanks

Alan
alanchcw
 
Posts: 1
Joined: 18. September 2014 15:44
Operating System: Linux

Re: redirect in .htaccess does not work

Postby Nobbie » 18. September 2014 17:08

alanchcw wrote:However, this does not work. When I input http://www.datanumen.com/aor/%e2%80%9d in FireFox or IE, the browser still said the page not found(404) error.


But, as you can see, the URL as changed to http://www.datanumen.com/outlook-repair/%E2%80%9D (which results in Error 404 as well).

The redirect does not "strip" the invalid filename and appends it to the new destination. You cannot use redirect in that case, you have to "rewrite" the URL:

Code: Select all
RewriteEngine On
RewriteRule ^aor/%e2%80%9d$ http://www.datanumen.com/outlook-repair/ [R=301]
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 25 guests