Rewrite rule in 2.0 doesn't work in 2.2 help required

Discuss practical ways rearrange URLs using mod_rewrite.

Rewrite rule in 2.0 doesn't work in 2.2 help required

Postby flatpackedworld » Tue Sep 16, 2008 4:48 am

Hi,

We had a rule as follows which worked fine in 2.0.x but in 2.2 doesn't work at all. Can anyone help.

Code: Select all
RewriteCond %{QUERY_STRING} !(siteid\=[[:digit:]]+)
RewriteRule .* %{REWRITE_RULE}?siteid=1234 [QSA,L]


This forces the siteid to be appended all the time. We don't want to use [R] either.

Can anyone help!
flatpackedworld
 
Posts: 2
Joined: Tue Sep 16, 2008 4:43 am

Postby flatpackedworld » Tue Sep 16, 2008 5:47 am

Got around it by changing the rewriterule to

Code: Select all
RewriteRule ^/*(*.\.cfm) $1/?siteid=1000 [QSA,L]


It's not pretty, but, it seems to do the job just fine. Let me know if there's a better way!!
flatpackedworld
 
Posts: 2
Joined: Tue Sep 16, 2008 4:43 am

Postby richardk » Tue Sep 16, 2008 11:55 am

The problem is most likely because of [[:digit:]], try [0-9] instead
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} !^(.*&)?siteid=[0-9]+(&.*)?$ [NC]
RewriteRule .* %{REWRITE_RULE}?siteid=1234 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 4 guests

cron