Streaming live at 10am (PST)

No Current Page Indicator When Using .htaccess file

Hi was wondering if someone knows the answer to my issue :grinning:

On all my self hosted website, I use an .htaccess file to strip the .html extension and force HTTPS.

That all works fine as expected.

The issue that I’m having is that once I add the .htaccess file, The current tag in on my menu no longer works for pages other than the home page (ex. the “contact” page on the menu should turn blue when you are on that page, with .htaccess file active, it stays black when on the page).

I contacted my hosting provider and they dug into the code and said it there must be some conflict with the current tag and it needing the .html extension to be active.

Everything works fine on the WebFlow temporary hosting…I would imagine they use an .htaccess file to strip the HTML extension.

Not the end of the world not having that work, but kinda embarrassing if I have a client ask why it doesn’t work and I don’t have a answer for them…

Hopefully someone has run across this problem and has a solution! TIA!

Please share a link to your published site so someone could take a look.

This is what I have in the .htaccess:

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

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

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

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

The issue lies in the fact that the menu is still made up of links that include the .html extension. So when the webflow script is comparing the current URL to menu items, there is no match.

Instead of modifying the core webflow script, you could just remove the HTML extension within internal links on your site pages, then the w–current class would be added as normal.

Or you could just add your own script to handle that as well. Search for w–current in the source js file and you can see where the function lives.

1 Like

Thanks for taking the time to take a look! I will try changing internal link to not use .html, hopefully that will solve it.