httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel-St├ęphane SMORGRAV <Axel-Stephane.SMORG...@europe.adp.com>
Subject RE: [users@httpd] mod_rewrite and multiple parameters
Date Fri, 16 Jun 2006 13:42:58 GMT
Here you go:


RewriteRule ^/seach/(.*) /myscript.php/$1

RewriteRule ^/myscript.php/([a-z])([0-9]+)/(.*) /myscript.php/$3?param_$1=$2 [QSA,N]
RewriteRule ^/myscript.php/([a-z])([0-9]+)$ /myscript.php?param_$1=$2 [QSA,L]

-ascs

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Gioele Barabucci
Sent: Friday, June 16, 2006 2:57 PM
To: users@httpd.apache.org
Subject: [users@httpd] mod_rewrite and multiple parameters

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


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