1

The 301 is redirecting but it is appending the old url onto the end of the new url, like so:

http://www.example.co.uk/new-dir/new-page/?/old-dir/old-page/

This is my .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.co.uk [NC]
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [R=301,L]
Redirect 301 /old-dir/old-page/ http://www.example.co.uk/new-dir/new-page/
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?/$1 [L]

1 Answer 1

1

Don't use mod_alias for your redirect; they're not operating in the order that you're expecting based on the order you've put them in in the file. The query string added to the redirect location is coming from that last RewriteRule.

Replace your Redirect line:

RewriteRule ^old-dir/old-page/?$ http://www.example.co.uk/new-dir/new-page/ [R=301,L]

This is assuming your htaccess context is the document root.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .