Mod_rewrite with Query_string with condition problem

Discuss practical ways rearrange URLs using mod_rewrite.

Mod_rewrite with Query_string with condition problem

Postby Asianj79 » Fri Feb 06, 2009 12:36 pm

hi ,
I am trying to implement the mod rule for the following

http://www.host123.com/find.jsp?page=/o ... .....(many other Param)

Now if the page variable is like
page=/orbit/apt/ccd/km/sol/....
page=/orbit/apt/cgy/ly/lku/.....
page=/orbit/apt/mkw/de/snl/.....
IN SHORT IT CAN BE
page=/orbit/apt/<ANY DIR having ccd ,cgy,mkw>/<ANY DIR>/<ANY DIR>/......

The url should be allowed for user to view but if the page variable is any of above mentioned directory (ccd ,cgy,mkw) but if the dir is (cks,cop,vki) i.e page=/orbit/apt/cks/km/sol/....
the user should not be able to see the page and gone error should be reported.

Any idea how this can be implemented via mod rule , i have tried unsuccessfully so far with Query_string manipulation. Any ideas will be highly appreciated.
Asianj79
 
Posts: 1
Joined: Fri Feb 06, 2009 12:21 pm

Postby richardk » Sat Feb 07, 2009 12:07 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?page=/orbit/apt/(cks|cop|vki)(/[^&]+)?(&.*)?$ [NC]
RewriteRule ^find\.jsp$ - [G,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 21 guests

cron