Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to hide file name extensions from your website url!

We all know that repl doesn't support .htaccess but there are still ways to work around the issue!

First, make a new nodejs repl, then install express and fs.

Run npm i express in the shell to install express.
Run npm i fs in the shell to install fs.

Next, after you require these, your going to write the express code below.

Now, add a folder named public to your project, and add your html and css, if you need to add javascript (for the site) too do so in that folder.

Now say you have a terms of service file, you can just do something like this!

Make sure to replace file.html with your file name.

That's all! You have to do this for every single file, although you could probably make a system which does it for you!

Also in your <a></a> tags make sure you set href to what is shown in the app.get statement.