Remove file extensions

Hi

I’ve been trying for ages to try and remove the file extensions on my URLs. A few posts pop up on search but none of the examples have worked, although I now have set up a 404 page.

Can anyone tell me how to remove the file extensions?

Thanks :slight_smile:

Here’s the one that seems to work here:

You gotta use the rewite base line

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# Replace html with your file extension, eg: php, htm, asp

You beat me to it! :smiley:

I understood nothing of this code :smiley: . Joking.

This isnt working for me, should I remove the line already in the .htaccess file? This is what my file looks like: I also have an inex.php… should I replace that?

RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

# HTID:1744699: DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES BELOW
php_value display_errors 1
# DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES ABOVE HTID:1744699: