Reputation: 317
301 Redirects are not working properly because the ruleset in the mod rewrite is somehow getting added to the end of the 301 Redirect. For example, if my 301 Redirect looks like this:
Redirect 301 /directory/oldpage.html /directory/newpage.html
the redirect will go to:
/directory/newpage.html?section=directory&page=oldpage
Here is the mod rewrite in htaccess:
RewriteRule ^directory/(.*).html$ /directory/controller.php?section=directory&page=$1 [L]
page and section variables are defined through the included page’s file name.
Upvotes: 1
Views: 24
Reputation: 784938
Have your rules in this order:
RewriteEngine On
RewriteRule ^directory/oldpage.html$ /directory/newpage.html [L,NC,R=301]
RewriteRule ^directory/([\w-]+)\.html$ directory/controller.php?section=directory&page=$1 [L,QSA,NC]
Make sure to test in a new browser to avoid old cache.
Upvotes: 1