Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

This is my .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\ [NC]
RewriteRule ^(.*)$$1 [R=301,L]
Redirect 301 /old-dir/old-page/
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?/$1 [L]
share|improve this question
up vote 1 down vote accepted

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/?$ [R=301,L]

This is assuming your htaccess context is the document root.

share|improve this answer
Perfect! Thank you. – showFocus Feb 19 '12 at 22:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.