Page 1 of 1

Pretty URLs and mod_rewrite page redirect problem

Posted: Tue Oct 18, 2011 3:47 pm
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

Re: Pretty URLs and mod_rewrite page redirect problem

Posted: Tue Oct 18, 2011 3:59 pm
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.