To answer my own question: it's a problem with Apache's super-stupid feature to silently refuse all URLs with "%2f" in the path URI part with a fake and misleading 404 message.

In 2.x you can disable it using the following directive:

  AllowEncodedSlashes On

This however needs to be done on a server-wide level or in a virtual host configuration, so you need access to one of those.

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

On 15. Aug 2008, at 19:25, Jaka Jančar wrote:

I should add that "?" (%3f), for example, works as expected:

- mod_rewrite works (no 404, gets passed to index.php)
- "path" segments get split properly into key/value pairs
- it gets properly unencoded:
   [_params:protected] => Array
       (
           [controller] => controller
           [action] => action
           [key] => val?ue
           [module] => default
       )

Jaka

On 15. Aug 2008, at 19:16, Jaka Jančar wrote:

Hi!

Do parameter values which contain slashes using mod_rewrite work for anyone?

If I use:
http://host/controller/action/key/value/
everything works as expected. However if the value has a slash in it, like:
http://host/controller/action/key/val%2fue/
I get a 404 Not Found! :/

"The requested URL /controller/action/key/val/ue/ was not found on this server."

Oddity 1: Why even 404, shouldn't everything go to index.php?
Oddity 2: Why is the slash unescaped in the error message?

My Apache configuration:
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

Any ideas?

Regards,
Jaka Jancar


Reply via email to