How can I Remove .html on exported sites and use WWW and HTTPS

What is best method to remove .html from exported files and also redirect to WWW and HTTPS? I am trying to use htaccess with my cPanel server.

You can find your other questions answer in the CPanel user docs.

Is this best method from all them?

This should work for you:

#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]

#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} [1]{3,9}\ /..html\ HTTP/
RewriteRule ^(.
).html$ /$1 [R=301,L]


  1. A-Z ↩︎

Clean URL questions have been asked and answered many times.

Take a look at these topics.

https://discourse.webflow.com/search?q=How%20can%20I%20Remove%20.html

In case anyone is looking for this, the solution that worked and removed the .html from everywhere without having to search and replace anything is this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]

#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]

#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]

ErrorDocument 404 /404.html
</IfModule>