Could you tell me why this rewrite do not pass 2nd value? tt value is passed in to %1 but name is not in to %2
RewriteBase /
RewriteRule ^wedding-hair-and-make-up-images-([^/]*)-(.*)\.php$ franchisee-gallery.php?franchise_name=$1&id_tt=$2 [L]
RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD|TRACE)\ /franchisee-gallery.php
RewriteCond %{QUERY_STRING} name=([^\&]*)
RewriteCond %{QUERY_STRING} tt=(.*)
RewriteRule ^franchisee-gallery.php$ wedding-hair-and-make-up-images-%1-%2.php? [R,L]
The %N refeers to the matching groups of last condition, so %1 is the match of condition:
RewriteCond %{QUERY_STRING} tt=(.*)
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#RewriteCond
RewriteCond backreferences: These are backreferences of the form %N (1 <= N <= 9), which provide access to the grouped parts (again, in parentheses) of the pattern, from the last matched RewriteCond in the current set of conditions.
For your case, you could rewrite the access of “franchisee-gallery.php” to another PHP, that makes the redirection ( via HTTP Header Location ). I can’t figure it out how to make this via Rewrite. Maybe with PERL External Rewriting Program, using RewriteMap.
Solution founded! Using custom environment variables, it’s possible to store the matched values in temporary variables!