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.

Inside httpd.conf:

 rewriterule  ^questions/([0-9]+).*  ...

It matches /questions/1674/<textarea>,but not /questions/1674/<textarea><%2Ftextarea>

share|improve this question
1  
Are you rebuilding ServerFault? :-) –  Josh Mar 23 '10 at 13:01

2 Answers 2

Maybe you need the No Escape [NE] flag on the rule? Search for noescape in this page.

share|improve this answer
    
This flag deals with the output of rewrite,but my problem seems to be the input of the rewrite. –  apache Mar 21 '10 at 2:59

If you have an encoded forward slash in the URI, Apache returns an immediete 404. The error log will state:

[info] [client 1.2.3.4] found %2f (encoded '/') in URI (decoded='/question/1/'), returning 404

To work around this, add to your httpd.conf root or <VirtualHost> section the following directive:

AllowEncodedSlashes On

And then your rewrite will work. Information from the Apache manual:

The AllowEncodedSlashes directive allows URLs which contain encoded path separators (%2F for / and additionally %5C for \ on according systems) to be used. Normally such URLs are refused with a 404 (Not found) error.

For more information, see:

http://httpd.apache.org/docs/2.0/mod/core.html#allowencodedslashes

http://blog.dynom.nl/archives/Apaches-fail-with-encoded-slashes_20090625_40.html

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.