On my website, I have the following .htaccess file to have cleaner urls:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This is working great when users type in hostname.com/filename, however it cancels the automatic redirect when users browse to hostname.com/map/, as the RewriteEngine automatically adds .php after the map, which gives the following result:
https://hostname.com/map/.php
Is there a way of using index.php as my index file being used when an user browse to a map instead of a file, while still having the same effect on users browsing to a file? So the expected outcome is based on 3 options:
The user is browsing to https://hostname.com/file: In which case the RewriteEngine should automatically redirect the user to https://hostname.com/file.php without changing the visible url;
The user is browsing to https://hostname.com/map/: In which case the RewriteEngine should automatically redirect the user to https://hostname.com/map/index.php without changing the visible url;