htaccess 301 rewrite and pretty URLs

I have found a big problem with htaccess and a CMS that I use.

When I enable "pretty URLs", 301 rewriting cannot be used properly.

See my forum posts at


After each htaccess change, do not forget to do the following: clear CMS cache, clear browser cache, press ctrl+F5, and after page reloads, try your address query again.


What works:

See two links above for examples of redirects that work.

For example, a relative path to non—pretty query:

redirect 301 /about-this-website.html


What does not work with "redirect 301" method:

redirect 301 /about-this-website.html


How to get 301 redirect to work:



With about half an hour of tweaking on my second attempt, I got it to work.

To summarize:

Old 301 rewrite rule was something like
redirect 301 /portals/electronics-as-a-hobby/general-and-misc-2.html

To convert to a RewriteRule, use a ^ character. I think that this does pattern matching. Do not use opening "/". Add $ at the end of old page URL.

Any one character off will break the rewrite functionality.

RewriteRule ^portals/electronics-as-a-hobby/general-and-misc-2.html$ [R=301,L]

Is the code to redirect a .html page that used to be within subfolders (as far as could be seen from outside CMSMS) (or parent pages in CMSMS) /portals and /electronics-as....



Also, watch out for tiny errors in htaccess formatting, that will bring down your website (search this website for examples of such errors). For example:


#redirect 301 /Alien Shooter Games Series


#redirect gone /uploads/publications/Michael's Memory Download - Linux.odt


˅˅˅ Additional valuable information is available at one of the links below: ˅˅˅


Did you like the article? Let Google Search know by clicking this button: . Please link to content that you find useful on this website on your own website, forum or blog! You can also comment on this page below, or to ask a question or suggest a topic for me to research. There is a user-editable Wiki available on my website, as well as a Forum that you can contribute to. Site Map.

Page last modified 29-Sep-11 20:17:22 EDT
Comments on this page: