Note:
Websites published on Webflow will have extension-less (without .html) URLs by default. When you export code from Webflow we give the files extensions (add .html) because you can’t have extension-less files on a local machine (unless you set up a local server, but that can be very hard for some folk).
I understand why the files need a file ending when downloaded, but how can we reverse the .html file addition when we upload via FTP?
I know a .htaccess file would clear up the problem, but I would really prefer a method that’s part of the webflow file system or at least works well within it.
Hey @bartekkustra - would this interfere with a custom 404 page when exported and hosted on our own server? I’ve just got this and this 404 code in my .htaccess file and it throws an error 500 instead of a 404.
What I think might be the issue is that in .htaccess you specify which document should be shown once the error occur. But if the document is not available at the given directory it might get into an infinite loop that tries to show a 404-page that you can’t find a 404 page that you can’t find a 404 page… etc.
Try removing the / sign from /404.html and check how that works. If you find troubles with that contact me using details in my profile.
I understand this is fixed with the .htaccess file, but wouldn’t it be easier to create new folders and place the html of the page inside (called index.html)? It would have to reference the css and js folders using “…/”, but I think it would be a better solution than .htaccess.
I’m a little confused too. Why not use the standard Web tricks for this? They require nothing special server-side: base tag, relative URIs, folders with index.html files, etc. Much, much better than using .htaccess and (uuugh) mod_rewrite.
It would be really nice to be able to just serve up the downloaded files and get a working site with the intended URLs intact.
OK, sorry for the whining After an hour of trying to get the rewrite rule translated for nginx (the server I use), I found out about “try_files”. It’s nifty and provides a partial solution:
That tries each option in order until it finds a file. Otherwise (last option) it returns a 404. For example for “/foo” it tries “/foo”, then “/foo/index.html”, then “/foo.html” which will work with the Webflow style.
The only problem left is that all the links on the pages use the .html, thus promoting crawlers to index that instead of the desired URLs. I can parse and rewrite all the html files after downloading, but IMO I shouldn’t have to.