URL without .html

When I export a website, all the urls show “.html” in the browser address bar except for the homepage. How can I make them clean urls? The Webflow staging for the same website uses clean urls. Thanks for the help!

Duplicate of

How to remove .html from URL?
remove html extension using htaccess file
.htaccess remove .html
remove .html with htaccess
Remove “.html” from URL via .htaccess
Adding clean URL Ecwid code to .htaccess file within web flow

Ok thanks! Wasn’t sure if it’s something I need to do in Webflow before export or not. htaccess seems to be my answer. :grinning:

Yeah, that is something Webflow does for you if you’re hosting with them, because it has to be done on the server-side.

If you want to apply this same effect on your own server, those links above is basically what you need to do.

I tried adding to my .htaccess. I am already forcing https now.

Can’t get it to rewrite the html completely. It works on 2 of my 6 pages. Weird, you would think it would work on all or none. Any suggestions how to get his working?

Here is what I have in my .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.html [NC,L]

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

what’s the page URL that’s not redirecting correctly?

Without html seems impossible to the media design but to my Desktops and Websites it was flexible.

Ok hopefully this helps someone.

here is the solution for anyone looking how to get a clean URL with a .htaccess file:

Create a file with the info:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.  <em>index\ HTTP/
RewriteRule ^(.</em>  )index$ [http://YOURWEBSITE.COM/$1](http://yourwebsite.com/%241) [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ [http://YOURWEBSITE.COM/$1](http://yourwebsite.com/%241) [L,R=301]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+).html\ HTTP/
RewriteRule ^(.+).html$ [http://YOURWEBSITE.COM/](http://yourwebsite.com/)1 [L,R=301] RewriteRule ^([\w-]+) /$1.html [L]

*replace YOURWEBSITE.COM with the url of your website all lowercase.

Place the .htaccess file in the folder with the html for your website.

dzięki za pomoc przydało m isię :slight_smile:

1 Like

It’s not good with URL. It has to be composed of html and free software download is the answer with that.

Works flawless here. Even on https. Removes:

  • .html from url
    -removes /index from home page

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]

RewriteEngine On
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]