Forum Moderators: phranque
RewriteRule ^/temp/([^/]+)/([1-9]*).htm template.php?folder1=$1&num=$2 [L]
But sometimes I'd like an extra variable in querystring. For example, I might want to pass the value of $id, typing an url like this:
http://www.example.com/temp/folder/12.htm?id=120
Which I'd like to result in rewriting to this:
http://www.example.com/template.php?subfolder1=folder&num=12&id=120
So, I wrote this rule:
RewriteRule ^/temp/([^/]+)/([1-9]*).htm?([^/]*) template.php?folder=$1&num=$2&$3 [L]
But, well easy to figure, it isn't working for me.
I'd appreciate any suggestion,
Storm
You'll need to use
RewriteCond %{QUERY_STRING} (.+)
to examine the query string appended to the requested URL. You may then back-reference your RewriteCond pattern using %1-%9
(See RewriteCond documentation in Apache mod_rewrite)
Jim