(I posted this on StackExcahnge but got no responses. Hoping someone here can suggest a solution.)
I want to enter localhost/expl/admin/add-edit-category/ and have it process localhost/expl/admin/add-edit-category.php
The following .htaccess works fine on two different production servers, but results in a 404 on localhost (Wampserver 3.1.3, Apache 2.4.33, PHP 7.1.16)
RewriteBase /expl/
RewriteRule ^admin/([A-Za-z0-9-]+)/?$ /expl/admin/$1\.php [QSA,NC,L]
However, if I do something like this, it's fine on Wampserver:
Enter: localhost/expl/dummy-dir/admin/add-edit-category/
RewriteRule ^([A-Za-z0-9-]+)/admin/([A-Za-z0-9-]+)/?$ /expl/admin/$2\.php?dir=$1 [QSA,NC,L]
It will read the variables just fine and everything works as expected. So why is the first case falling over?
Another related issue (which is resulting in "too many redirect" errors) is localhost already allows entering URIs without file extensions, so e.g.
localhost/expl/admin/add-edit-category in the address bar processes
localhost/expl/admin/add-edit-category.php,
but I don't want it to do so (it's not how it works on the production servers and I need it to be consistent on my local machine). I can't find any settings in Wampserver that cause this, so I haven't been able to edit it.
I want to enter localhost/expl/admin/add-edit-category/ and have it process localhost/expl/admin/add-edit-category.php
The following .htaccess works fine on two different production servers, but results in a 404 on localhost (Wampserver 3.1.3, Apache 2.4.33, PHP 7.1.16)
RewriteBase /expl/
RewriteRule ^admin/([A-Za-z0-9-]+)/?$ /expl/admin/$1\.php [QSA,NC,L]
However, if I do something like this, it's fine on Wampserver:
Enter: localhost/expl/dummy-dir/admin/add-edit-category/
RewriteRule ^([A-Za-z0-9-]+)/admin/([A-Za-z0-9-]+)/?$ /expl/admin/$2\.php?dir=$1 [QSA,NC,L]
It will read the variables just fine and everything works as expected. So why is the first case falling over?
Another related issue (which is resulting in "too many redirect" errors) is localhost already allows entering URIs without file extensions, so e.g.
localhost/expl/admin/add-edit-category in the address bar processes
localhost/expl/admin/add-edit-category.php,
but I don't want it to do so (it's not how it works on the production servers and I need it to be consistent on my local machine). I can't find any settings in Wampserver that cause this, so I haven't been able to edit it.