httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arthur Kerpician <art...@bluechip.ro>
Subject [users@httpd] rewrite rules optimisation
Date Mon, 14 May 2007 15:12:23 GMT
Hi,
Im having trouble with defining some rules. This is the layout:
I want to send some GET vars in the URL like this:
http://localhost/a-1,b-2,c-3,d-4/
Based on this format, the rewriting engine should forward the request 
like this:
http://localhost/index.php?a=1&b=2&c=3&d=4

I know I can write a rule like this:
RewriteRule /a-([0-9]+),b-([0-9]+),c-([0-9]+),d-([0-9]+) 
/index.php?a=$1&b=$2&c=$3&d=$1

The problem is that one or more of these vars can be missing (some of 
them are filters, order by data info) or can be send in a different 
position than the one defined by the rule, something like this:
http://localhost/d-1,a-2/ (should rewrite to 
http://localhost/index.php?d=1&a=2)
or
http://localhost/c-1/ (should rewrite to http://localhost/index.php?c=1)

The hard way, as I see it, is to take into account all combinations / 
possibilities and write a rule for each and every case. Im not a even 
close to be a mod_rewrite fair user but I know there should be an easier 
(optimised) way of doing this.

Thanks all for your input,
Arthur

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message