Checking different combinations of url parameters in rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

Checking different combinations of url parameters in rewrite

Postby selvam_pec51 » Thu Aug 28, 2008 4:57 am

Hi,

Greetings to all!

I have requirement like when i hit the following url
http://example.com/servlet/CS?pagename= ... ge&cid=123

it should redirect to the following one
http://example.com/phone

Note: The parameters pagename=bus&c=Page&cid=123 can be in any combination. For example the incoming url may like
http://example.com/servlet/CS?c=Page&pa ... us&cid=123
http://example.com/servlet/CS?cid=123&p ... bus&c=Page

whatever may the combination of parameters, it should redirect to the url "http://example.com/phone".

can someone please help in this regard?

Thanks in advance!
selvam_pec51
 
Posts: 7
Joined: Wed Jul 30, 2008 5:41 am

Postby richardk » Fri Aug 29, 2008 7:47 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?pagename=bus(&.*)?$ [NC]
RewriteCond %{QUERY_STRING} ^(.*&)?c=Page(&.*)?$ [NC]
RewriteCond %{QUERY_STRING} ^(.*&)?cid=123(&.*)?$ [NC]
RewriteRule ^servlet/CS$ /phones? [R=301,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 15 guests

cron