How to 301 redirect w/ mod_rewrite enabled

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
curlypinky
Forum Members
Forum Members
Posts: 109
Joined: Thu Sep 04, 2008 3:49 am

How to 301 redirect w/ mod_rewrite enabled

Post by curlypinky »

I've just recently redesigned an old static site to cmsms and needed to redirect the old pages. I found that using redirect 301 was producing urls that take you to the new page but then append ?page=oldpage.html which caused it to have a 401 error. Hunting around the forum I found that you need to use RewriteRule instead but it took me awhile to find the info then construct the string correct. Hopefully this will help out others needing to know how to build 301 redirects when mod_rewrite is enabled for pretty urls.


use RewriteRule instead of redirect 301 and place the code directly under

Code: Select all

RewriteBase /
Your redirect command should look like this:

Code: Select all

RewriteRule ^oldpage.html$ http://www.yoursite.com/newpage.html [R=301,L]
-Alane
Post Reply

Return to “Tips and Tricks”