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&param1=x&param2=whatever&param3=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

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -