I have a htaccess that rewrites to /login if conditions aren’t met.
It’s working fine for urls without query_string.
However I have no clue how to include /reset?query_string to accepted conditions. And want to exclude /reset
/reset?6tdsBMxpeeJEDUvYzwKmLzIusLYLjgMtIj
RewriteEngine On
RewriteBase /index.php
RewriteCond %{REQUEST_URI} !^/login$
RewriteCond %{REQUEST_URI} !^/forgotten$
RewriteRule ^([^.]+)$ /login [R=301,L,QSD]
RewriteRule ^(/)?$ /login [R=301,L]
RewriteRule ^([^.]+)$ $1.php [NC,L]
2
Answers
With your shown samples and attempts, please try following htaccess rules file. Make sure to clear your browser cache before testing your URLs.
Also I am making use of apache’s variable named
THE_REQUEST
by which we can handle both uri as well as query string.Here is a modified version of your .htaccess that excludes
/reset?query
:Make sure to test it after clearing your browser cache.