I have a web application that recently had its spec changed to allow for slashes in names of some of its documents. Resultantly, I have had to change my .htaccess file to also match slashes. However, the issue is that I only want to match slashes that are encoded i.e. catch %2F
but not /
.
Consider the following URL:
http://www.example.com/document/edit/STAT%2F12/
My .htaccess looks like:
RewriteRule ^document\/([a-z0-9-]+)?\/?([a-z0-9-\W\s]+)?\/?$ documents.php?request=$1&id=$2& [NC,QSA,L]
The above request catches the $id
as 'STAT/12/' instead of 'STAT/12'. In other words, it matches the trailing slash even though it isn't encoded.
Please note, I have switched on AllowEncodedSlashes On
.