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
Htaccess help remove .php
- wwonderfull
-
- Posts: 1551
- Joined: Fri Aug 21, 2020 8:27 am
- Contact:
Re: Htaccess help remove .php
There are some good informations here check and see if it is useful.
https://stackoverflow.com/questions/402 ... h-htaccess
https://stackoverflow.com/questions/402 ... h-htaccess
- BaconFries
-
- Posts: 5842
- Joined: Thu Aug 16, 2007 7:32 pm
Re: Htaccess help remove .php
From a previous post by yourself you write you are using ionos? If so it could be that MutliViews is enabled and this could stop/break the .htacess. I am no expert in this but you can try adding the following below to the top of your .htacess file. GoDaddy has a similar issue but you need to add Options +MultiViews to the top/start of the .htacess for the page extension to be hidden so it could be you need to add what I suggest in ionos. If this doesn't help it might be best to contact your host.
Add to top/start of your code
Add to top/start of your code
Code: Select all
# Ensure that MutliViews is disabled
Options -MultiViews
-
-
- Posts: 26
- Joined: Mon Mar 23, 2015 1:41 am
Re: Htaccess help remove .php
Thank you, I shall try this. You are right, I do use Ionos.
Thanks ever so much
Thanks ever so much