I want to hide .html extension in URL, which I did by editing .htaccess file. If I click on any page then it opens without .html extension but when I manually enter url with .html extension it also opens the page and .html extension appears in the URL.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.html [L]
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
My requirement is to not allow a page to open up even if I enter .html in the url. Or it should automatically redirect when user enters URL with .html extension.
I don't know if the above code is correct. Please help me to fix it. Website: https://drkrinitamotwani.com/