How can I remove file extension from a website address?

Just add an .htaccess file to the root folder of your site (for example, /home/domains/domain.com/htdocs/) with the following content:

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

More about how this works in these pages: mod_rewrite guide (introduction, using it), reference documentation

Leave a Comment