[users@httpd] mod_rewrite and multiple parameters

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

 



Hi,

I use mod_rewrite to map URLs like this http://mydomain/seach/a10/b30/c9/f99
to myscript.php?param_a=10&param_b=30&param_c_new=9&param_f=99.
Everithing works fine but, as the number of (optional) parameters increase,
I need to create too many RewriteRules.

My RewriteRules are like this

RewriteRule ^a([0-9]*)$ myscript.php?param_a=$1
RewriteRule ^b([0-9]*)$ myscript.php?param_b=$1
...
RewriteRule ^f([0-9]*)$ myscript.php?param_f=$1

RewriteRule ^a([0-9]*)/b([0-9]*)$ myscript.php?param_a=$1&param_b=$2
RewriteRule ^a([0-9]*)/c([0-9]*)$ myscript.php?param_a=$1&param_c=$2
...
RewriteRule ^a([0-9]*)/f([0-9]*)$ myscript.php?param_a=$1&param_f=$2
RewriteRule ^b([0-9]*)/c([0-9]*)$ myscript.php?param_b=$1&param_c=$2
...
RewriteRule ^e([0-9]*)/f([0-9]*)$ myscript.php?param_e=$1&param_f=$2

RewriteRule ^a([0-9]*)/b([0-9]*)/c([0-9])$ myscript.php?param_a=...

and so on.

Is there a way to say

* let's start with url = 'myscript.php?'
* if a([0-9]*) matches; url += param_a=$1
* if b([0-9]*) matches; url += param_b=$1
* if c([0-9]*) matches, url += param_c=$1
 ...
* at the end connect to url.


-- 
Gioele <dev@xxxxxxxxxxxxxxxxxxx>


---------------------------------------------------------------------
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