Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web site using mod_rewrite to get some clean urls and custom 404 pages. My .htaccess file looks like this:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?clean_url=$1 [QSA,L]

What puzzles me is that if the URL contains a %2F (url-encoded /) the server seems to force a 404. As an example, would be a normal article, but then gives a server-generated 404 page. (not the custom 404 page)

I wouldn't have expected this... why this is happening? Is there a way around it?

share|improve this question
up vote 1 down vote accepted

The URLs and are not equal. According to RFC 2616 §3.2.3, reserved characters have special significance (which is, after all, the whole point of URL escaping). RFC 2396 §2.2 lists / as such a reserved character. In the context of HTTP URLs, / delimits path elements, while %2f is a literal slash.

In Apache, AllowEncodedSlashes On would prevent the request from being immediately rejected with a 404.

share|improve this answer

Your Answer


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.