Why does Apache delete multiple slashes?

This RewriteRule

RewriteRule ^test/(.*)$ test.php?url=$1

In this url

mysite.com/test//one///two////three///

Gives me this result

$1=url='one/two/three/'

I use easyphp if that matters, and I like to know why Apache removes multiple slashes internally without redirecting to the corrected URL? and how can I disable or add redirection to this behavior?

thanks in advance

+4
source share
1 answer

Multiple slashes seem to be against the standard. As stated in this post , RFC 1630 says:

PATH

The rest of the URI follows the colon in the format, depending on the scheme. The path is interpreted depending on the protocol used. However, when it contains slashes, these ust implies a hierarchical structure.

/// does not imply a hierarchical structure - you will have empty folder names. From this, I would suggest that Apache's design behavior. (And it would be nice to use a few slashes, as the result would be an incorrect URL).

Instead, I would use a different character.

+8
source

Source: https://habr.com/ru/post/1388912/


All Articles