I have HTML website hosted under Apache. Following htaccess added to redirect all the http
calls to https
and hide the extension from URL.
I have following pages in it
Home page - example.com <- index.html
About - example.com/about <- about.html
Contact - example.com/contact <- contact.html
404 - example.com/404 <- 404.html
htaccess
AddType application/x-httpd-php .html .htm
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
ErrorDocument 404 https://www.example.com/404.html
But if we call a page directly as https://example.com/contact.html
this will render with .html extension itself(same as example.com/contact.html), it supposed to be https://www.example.com/contact.
Anyone can help to solve this confusion?