Reputation: 21
I have a rewrite rule in place that redirects www.OLDsite.co.uk/locations.php?area=Barking,%20Essex
to www.NEWsite.co.uk/locations.php?area=Barking,%20Essex
...ideally, anyways. The problem exists at the end of the url. Instead of redirecting to the new site above like it should...it makes the following url instead: www.NEWsite.co.uk/locations.php?area=Barking,%2520Essex
. I am really confused...here's my .htaccess file as it stands currently...
RewriteEngine on
RewriteRule ^locations.php/(.*)$ http://www.NEWsite.co.uk/locations.php$1 [R=permanent,L]
ErrorDocument 404 /404.php
I'm new to mod_rewrites, but I'm willing to learn. I know it's a very powerful tool and it wouldn't be a bad thing to have in my developer arsenal. All tips are appreciated.
Upvotes: 1
Views: 1537
Reputation: 285
Issue is that:
%25 is equal to "%" symbol
But that would equal %20 or a space.. Dont use spaces..use "+"
Upvotes: 1
Reputation: 784878
Change your RewriteRule to this:
RewriteRule ^(locations\.php.*)$ http://www.localhost/$1 [R=301,L,NE]
Important change here is flag NE
which tell Apache to not encode the generated URI hence %20
remains %20
instead of becoming %2520
.
Upvotes: 2