Reputation: 145
I am developing a site and I am trying to rewrite URL's to make them nicer looking and to make them more accessible.
First, in PHP, I am using rawurlencode and rawurldecode to sanitize URL's.
Next, in my .htaccess file this is the RewriteRule I am using:
RewriteRule ^(/(/[^/]*/?)?)?([^/]+[a-zA-Z0-9])/(albums)/(.*)$ /name.php?name=$3&page=photos&album=$5 [L]
Firstly, this works perfectly with everything I have tried except one URL and I am not quite sure why as of yet.
The URL in question is: https://domain.com/name/albums/album%3B.%2F
Now I have an ErrorDocument set up in my .htaccess and it is not even going to that document, which it normally does. The 404 error is going to my domain hosts normal error page. I am trying to figure out why this isn't working, as the URL is sanitized, so I am not sure what would be causing this issue.
In case you're wondering the last part of the URL is encoded from "album;./"...
If you have any suggestions as to how to fix this error that is being caused let me know. I appreciate any replies in advance.
Upvotes: 0
Views: 254
Reputation: 143906
Try adding a NE flag in your rule so that the %3B.%2F
doesn't get re-encoded in the query string as %253B.%252F
:
RewriteRule ^(/(/[^/]*/?)?)?([^/]+[a-zA-Z0-9])/(albums)/(.*)$ /name.php?name=$3&page=photos&album=$5 [L,NE]
Upvotes: 1