.htaccess - Apache RewriteRule of multiple variables in query string -
i've been trying figure out how write new rewrite rule struggling badly. removing world-wide (ww) site domain.com , want forward old links country selector. appreciated. thank in advance.
# if user goes url www.domain.com/products/folder1/folder2/index?sku=123&var2=abc&isocountrycode=ww # forward them url www.domain.com/choose/country_selection?ref_url=/products/folder1/folder2/index.cfm?sku=123&var2=abc # attempt not work rewritecond %{query_string} ^(.*)isocountrycode=ww(.*)$ [nc] rewriterule ^(.+)$ /choose/country_selection.cfm?ref_url=$1?%1%2 [l,r=302]
i have been using website test code http://martinmelin.se/rewrite-rule-tester/
answered own question. helicontech ape requires second ? escaped backslash...
rewritecond %{query_string} ^(.+&)?isocountrycode=ww&(.+)?$ [nc] rewriterule ^(.+)$ /choose/country_selection.cfm?ref_url=/$1\?%1%2? [nc,r=301,l] rewritecond %{query_string} ^((.+)&)?isocountrycode=ww$ [nc] rewriterule ^(.+)$ /choose/country_selection.cfm?ref_url=/$1\?%2? [nc,r=301,l]
Comments
Post a Comment