We do support Round the Clock 24 x 7 x 365 (+91) 883 012 3924

Remove .html extension with the help of .htaccess file

Remove .html extension with the help of .htaccess file

If you want user-friendly URLs on your site and hide .html extension then this post is useful for you.

Please follow below steps to hide .html file extensions :
# Open .htaccess file and add below rewrite rules

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.html [NC,L]

Now your server will remove .html file extension from all URLs.
For example, http://example.com/file.html will become as http://example.com/file

Please also check: https://www.l3webhosting.com/blog/remove-php-extension-with-htaccess/

Leave a Reply

Your email address will not be published. Required fields are marked *