Page 1 of 1

301 redirect in .htaccess from query string to pretty url

Posted: Mon Jul 05, 2010 1:08 pm
by JM6891
Hi there,

I'm not sure if I've posted this in the correct place, but here goes...

I'm trying to apply a series of 301 redirects from a clients current site to the new cmsms site which uses pretty urls.

Normal redirects work fine i.e

Code: Select all

RewriteRule ^page\.php$ http://www.website.com/page.html [R=301,L]
However, I'm having trouble redirecting a pages with a query string,

i.e page.php?id=2 to page.html

I have tried:

Code: Select all

RewriteCond %{QUERY_STRING} id=([0-9]+)
RewriteRule ^vpage.php$ %page.html? [R=302,L] 
This however doesn't work. The htaccess I'm using is the one out of the doc folder from the cmsms install. Do you think there's maybe a conflict between code that already exists in this file, i.e:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Thanks in advance

Re: 301 redirect in .htaccess from query string to pretty url

Posted: Mon Jul 05, 2010 2:02 pm
by calguy1000
This is not a CMSMS issue... you would probably be better off going to an apache specific forum.

Re: 301 redirect in .htaccess from query string to pretty url

Posted: Mon Jul 05, 2010 2:58 pm
by JM6891
OK, no problem, just wasn't sure if there was conflict between what was in the cmsms default htaccess. Never mind. Thanks anyway,