Apache 2 - enable encoded slash support in path segments (/ encoding as %2F, e.g. /path/to%2Fendpoint)
In this short article, we would like to show how in Apache2 enable encoded slashes support in path segments.
By default, it is not permitted to use
%2F
in path segments, that causes 404 response in Apache2 server, and it is necessary to enable it.

Quick solution:
Add the following line into your host configuration:
xxxxxxxxxx
<VirtualHost *:80>
AllowEncodedSlashes On
</VirtualHost>
or:
xxxxxxxxxx
<VirtualHost *:80>
AllowEncodedSlashes NoDecode
</VirtualHost>
Warning: be careful using
%2F
in the paths, because some software may do not interpret it well,
e.g. some bots that crawl your website may decode URLs before calling your pages.
This section contains description for possible AllowEncodedSlashes
values that allows using encoded slashes in URLs.
VirtualHost Configuration | Description |
xxxxxxxxxx 1 <VirtualHost *:80> 2 ... 3 AllowEncodedSlashes On 4 ... 5 </VirtualHost> |
In that configuration URLs with It means: |
xxxxxxxxxx 1 <VirtualHost *:80> 2 ... 3 AllowEncodedSlashes NoDecode 4 ... 5 </VirtualHost> |
In that configuration URLs with It means: Sometimes it is necessary to allow slashes usage with proxy, which can lead to use Example: xxxxxxxxxx 1 <VirtualHost *:80> 2 ... 3 AllowEncodedSlashes NoDecode 4 ... 5 ProxyPass /proxy http://127.0.0.1:8080/ nocanon 6 ... 7 </VirtualHost> Where: |