I'm looking for a way to clean up my site's urls, like removing .php or .html when there is a file name in the url. Also if it's possible to easily hide GET extensions that would be nice too, but the .php is the main goal.
From other articles and SO questions I have this code in the .htaccess file in the main directory of a website:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
The first part redirect to https, if someone types the url with http. That part work fine. The second 3 lines should use a url without the .php extension on files. For example https://www.fixitconnect.com/users.php should be https://fixitconnect.com/users
I don't know how this syntax works so i was just copying other answers. Looks like it sets some conditions (if there is .php in the current file's name), then a rule (use a url without the .php) to be applied if those conditions are met. But i'm probably not doing it right.
Thanks :)