Htaccess help remove .php
Posted: Sat Sep 16, 2023 2:49 pm
Hi,
I know this isn't related to the software, however I hope somebody may be able to help. I want to remove file extensions (.php) from my links but of course I need to first configure this in htaccess.
I am aware that the correct code is
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
however, when I add this code underneath / above the existing code (to force https), nothing happens i.e. I still have to enter .php into the URL.
The htaccess file looks like this after adding the above code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://mysite.org/$1 [R=301,L]
Any ideas why this wouldn't be working?
Thanks
I know this isn't related to the software, however I hope somebody may be able to help. I want to remove file extensions (.php) from my links but of course I need to first configure this in htaccess.
I am aware that the correct code is
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
however, when I add this code underneath / above the existing code (to force https), nothing happens i.e. I still have to enter .php into the URL.
The htaccess file looks like this after adding the above code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://mysite.org/$1 [R=301,L]
Any ideas why this wouldn't be working?
Thanks