apache - Rewrite rule for replacing a single character. Once -
i need .htaccess files , mod_rewrite.
now i've got script sms payment provider, executes different tasks according variables parse it. problem is, script called like:
http://examp.le/path/script.php¶m1=x¶m2=whatever¶m3=823
and on. this, know, wrong. first character should query mark, not ampersand. need write rewrite rule replace first occurence of ampersand query mark. i've never been @ regex, or htaccess in general.
but. if you're answering, please explain characters , how in world work. thank in advance.
enable mod_rewrite , .htaccess through httpd.conf
, put code in .htaccess
under document_root
directory:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritecond %{the_request} \s/(script\.php)&(param1=[^\s]+) [nc] rewriterule ^ /%1?%2 [r=302,l]
once verify working fine, replace r=302
r=301
. avoid using r=301
(permanent redirect) while testing mod_rewrite rules.
Comments
Post a Comment