Streaming live at 10am (PST)

Internal links change to *.html after code export


#1

Hello everyone!
The question is simple:

When on Webflow hosting, I'm referring to internal pages as '/pagename' which works perfectly fine.
After exporting the code, though, all the links automatically change to 'pagename.html' which looks unprofessional when hosting externally.

Any ideas how to prevent this from happening?

Thanks,
Denis


Current link not showing in sub-directory on self hosted site
#2

Hey @denisbondar. I believe you can do this by creating an .htaccess file.

  1. Open Notepad and paste the following code:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule ^(.*)$ $1.html

  2. Save the file as ".htaccess" without the quotes.

  3. Upload to your public_html folder at your host and rename your page files to remove the ".html".

Let me know if that works for you!


#3

More information http://stackoverflow.com/q/5730092/584192


#4

Thanks @jordanshotwell @samliew!

.htaccess is not ideal solution in my case, as I'm using Gituhb Pages, which only supports static content (so .htaccess won't work there)

Any ideas on 1) how to prevent Webflow from adding '.html' to the links (in the process of export) in first place?; or 2) how to automatically remove/replace '.html' part from the body of html document on load to avoid removing it manually?


#5

UDT: just fixed it using this script:

$("body").html($("body").html().replace(/.html/g,''));
$("body").html($("body").html().replace(/index.html/g,'/'));


#6

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.