Learn to Code via Tutorials on Repl.it!

← Back to all posts
remove .html from file path
h
Codemonkey51

so you want to remove .html from the path

So I have seen a lot of people ask "how do I remove .html from the path" or "can I remove .html from the path" and the answer is actually yes you can.
To do this all you need to do is:
1) take the file you want to do it to let's say I want example.html to be /example
2) make a folder named example in the file tab
3) move example.html into the folder named example
4) rename example.html to index.html

And now goto /example it should display what example.html was, you can do this to any file name by replace example with the name you want to do it to (replace the name in these instructions) also if you want to know what file comes first if you have index.html and index.php in the folder look here: link that contains the default list (if you can't access that it is: index.html index.shtml index.php index.htm default.html Default.htm default.html Default.html default.shtml Default.shtml page1.html index.pl index.cgi index.php3 index.phtml home.htm home.html home.shtml index.wml)
And there you go a working path without .html

Voters
TNJS
SomeGuy25
jeanenchanted
Learn247365
SHENJINHUA
MarcusWeinberger
ebg97
AmazingMech2418
ChezCoder
CodingCactus
Comments
hotnewtop
TNJS

Thanks so much!

jeanenchanted

Woah! I've looked at other solutions which are waaay too complicated, but this is so simple and it works!

rediar

Another idea is using express.js or flask....

Codemonkey51

This is easier for fast and static pages no pinging it or other. Although I would use flask on a bigger project @rediar

[deleted]

i know y
cuz the name of the folder is example...
and in the folder example there is a html file...
so if you write /example it will write the files in the /example folder!
EZ PEASY LEMON SQUEEZY

Codemonkey51

Yep :) @Zuhdi28

[deleted]

@Codemonkey51 CLEVER(you)!

ChezCoder

Genius!

Codemonkey51

Lol I knew this for a while (forget where I learned it) and got tired of people asking so I took like 10 minutes made this :) @ChezCoder

ChezCoder
Codemonkey51

Ooh just noticed 6 upvotes :p and I'm the post in between 4 of @amazingmech2418 's posts on hot :D @ChezCoder

ChezCoder
Codemonkey51
AmazingMech2418

@Codemonkey51 LOL! It's a repl sandwich!

Codemonkey51
ChezCoder
Codemonkey51
Battledash2

ikr lol @Codemonkey51