rewrite rules optimisation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux