Streaming live at 10am (PST)

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

#1

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.

0 Likes

#2

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

0 Likes

#3

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} ^[A-Z]{3,9}\ /..html\ HTTP/
RewriteRule ^(.
).html$ /$1 [R=301,L]

0 Likes

#4

Clean URL questions have been asked and answered many times.

Take a look at these topics.

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

0 Likes

#5

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>
0 Likes