[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-httpd-users
Subject:    [users@httpd]  mod_rewrite and multiple parameters
From:       Gioele Barabucci <dev () gioelebarabucci ! com>
Date:       2006-06-16 12:57:09
Message-ID: e6u9rh$8o0$1 () sea ! gmane ! org
[Download RAW message or body]

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@gioelebarabucci.com>


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic