.htaccess url rewrite behavior being overwritten if filename minus ext. same as url
You may have a conflict with the MultiViews
option of mod_negotiation
. Your request may not be hitting the RewriteRule
at all, and is instead being handled by the give.php
because of mod_negotiation
. From the docs:
... if the server receives a request for
/some/dir/foo
, if/some/dir
has MultiViews enabled, and/some/dir/foo
does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.
Try adding this to your .htaccess
and see if things change:
Options -MultiViews
So some changes, first I would try some file conditions before the rule. Second the params as you wrote are only for numbers, and last QSA for more query.
RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-lRewriteRule ^give/(.+)$ give.php?step=$1 [QSA, L]