301 redirect in .htaccess from query string to pretty url

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
JM6891
Forum Members
Forum Members
Posts: 150
Joined: Thu Mar 18, 2010 2:35 pm

301 redirect in .htaccess from query string to pretty url

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post by calguy1000 »

This is not a CMSMS issue... you would probably be better off going to an apache specific forum.
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.
JM6891
Forum Members
Forum Members
Posts: 150
Joined: Thu Mar 18, 2010 2:35 pm

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

Post 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,
Post Reply

Return to “The Lounge”