Ask coding questions

← Back to all posts
Is there a way to remove the ".html" extension with .htaccess using

I tried updating my site to use an .htaccess file to remove the .html file extension from the URL. This did not work and I'm just getting the replit 404 pages. Here's my code:

Is there an issue with my code or does not support .htaccess rules? If it's not allowing it, is there any way I can do this without an .htaccess just as easily? Thanks. (I'm also wondering, if I link my repl to an actual domain will this issue still occur?)

Answered by a5rocks [earned 5 cycles]
View Answer

I mean, I would just code a simple backend. Flask or express or whatever.

But yeah, repl should add .htaccess working. (idk if your code is wrong btw)


@a5rocks I've tried my code on GitHub pages and it works fine. Any info on where I could learn to use flask or Express for this


@GavHern Well, I would just do something simple with Flask such as

Relevant SO question:

If you are using the code above, put all your html files in a "website" directory, all your css in a "css" directory, and all your js in a "js" directory

The only thing is that Flask is dynamic, and so your site will be slightly slower. If you really want to counteract that, I would look into, installing nginx using install-pkg nginx or whatever, and then customizing the command to allow .htaccess. If you do that, and post it on, I'm pretty sure repl will update html/css/js repls to allow .htaccess


This question is old but for any future users looking to do this - You do not have to use .htaccess files. You can just create a folder with your desired name and place into it an index.html