Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this URL rewrite rule

RewriteRule ^(send-your-request.*)$ / [NC,L,QSA,R=301]

it should basically just remove "/send-your-request" from the the URL (i.e. rewrite it with query string parameters from the domain i.e.

http://example.com/send-your-request/?a_aid=rocketnews24&pname=just%20a%20test

is rewritten to:

http://example.com/?a_aid=rocketnews24&pname=just%20a%20test

In that cases it works, but if I add the last parameter, it stops working

http://example.com/send-your-request/?a_aid=rocketnews24&pname=just%20a%20test&plink=http%3A%2F%2Fradio-eva.jp%2Fshop%2Fproducts%2Fdetail.php%3Fproduct_id%3D82

Can anyone tell me a better rewrite rule that can handle all the query string parameters?

EDIT here are my other rules, but I have "L" on the first one, so it should stop processing right?

RewriteRule ^(send-your-request.*)$ / [NC,QSA,R=301,L]
Redirect 301 /products http://whiterabbitexpress.com/
RewriteRule ^index\.php$ - [L]
RewriteCond %{QUERY_STRING} ^(.*)q=(.*)$
RewriteRule ^(.*)$ $1?%1s=%2 [L,R=301] 
RewriteRule ^catalogsearch/result/?$ / [NC,QSA,L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
share|improve this question
1  
Remove the QSA switch from your rules - as I understand the logic, you don't need to process query string. The query string appended in the regexp is the cause of your problem –  Kamil Šrot Nov 9 '12 at 19:45
    
@KamilŠrot I took the qsa off, but the behavior is same. If the final parameter is plink=123 it works (redirects), but if the final param is a url, it will not redirect (404 on my site)... :( –  Max Hodges Nov 12 '12 at 7:07

1 Answer 1

up vote 0 down vote accepted

Solved: it was a Mod_security rule designed to protect against injection. Working to get it disabled now.

SecRule REQUEST_URI "=(?:ogg|gopher|data|php|zlib|(?:ht|f)tps?)://" \ "capture,id:340165,t:none,t:urlDecodeUni,t:replaceNulls,t:compressWhiteSpace,t:lowercase,rev:275,severity:2,msg:'Atomicorp.com UNSUPPORTED DELAYED Rules: Uniencoded possible Remote File Injection attempt in URI (AE)',logdata:'%{MATCHED_VAR}'"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.