How to hide .html from urls

Hello everyone, everything good? I am trying to hide the .html from my urls, but to no avail. I am a beginner in codes and I am struggling. I saw two tutorials here on the forum, but I couldn’t do them. One required nodejs and the other was about .htaccess, but my website doesn’t have that file. Any idea?

Hi @chilligrr, welcome to the forums!
To do this, you can simply rename each of your files from filename.html to filename/index.html and everything should just work :slight_smile:

1 Like

Hey it works! Hehe thank you so much!

Maybe do something similar like Texa does it: Texa (deno web framework) - #9 by ihack2712

You can try make this file work for whatever framework you’re using. https://deno.land/x/texa@0.8.1/src/middleware/static.ts

Using .htaccess works too!

I read about, but i don’t find a tutorial to create .htaccess to my glitch website. You know a good tutorial?

Use:

What you need in your .htaccess for that is below. I have some other nice rules that you might be interested in here (such as HTTPS forcing, etc)

RewriteEngine On

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

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