Pretty URLs and mod_rewrite page redirect problem

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
LadyHLG
Forum Members
Forum Members
Posts: 38
Joined: Wed Apr 21, 2010 1:47 pm

Pretty URLs and mod_rewrite page redirect problem

Post by LadyHLG »

We have pretty urls enabled with mod_rewrite, which is working fine, but I am running into a small problem. We are using .html for our current page extensions, but had some previous pages with .php that we want to redirect any incoming links to the new pages with .html extensions.

example -
previous site - books.php
new site - books.html

These automatically redirect to books.html?page=books.php, which of course throws a URL not found error.

I'm assuming this is because of the rewrite rules in place.

Code: Select all

# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
How can I get these to redirect correctly?
Any help would be greatly appreciated!
Thanks
LadyHLG
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Pretty URLs and mod_rewrite page redirect problem

Post by calguy1000 »

Use 301 redirects ABOVE your CMSMS rules (IIRC) to redirect the old page to the new page.

Or You could use a funky rewrite rule (again above your CMSMS rules IIRC) to change requests ending with php to html.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “CMSMS Core”