Skip to content
← Back to Community
How to remove [.html]
Profile icon
Purple01Flame

When I have another page in my website it would be
https://example.com/meme.html

How do I remove the .html?

Answered by Codemonkey51 [earned 5 cycles]
View Answer
Voters
Profile icon
AdriaDonohue
Profile icon
Purple01Flame
Comments
hotnewtop
Profile icon
Codemonkey51

@Purple01Flame all you have to do is create a folder named meme and put index.html in there then the index.html will show up on pageurl/meme

Profile icon
MrEconomical

rght now you are using static hosting which means it will just serve all your files as if it is a directory. in order to remove the .html you will need to use a router which is a bit more complex but very doable. You can see some examples in the websites I have made in the past:
https://repl.it/@MrEconomical/ecocode
https://repl.it/@MrEconomical/eco-studios

Profile icon
zexsy

@MrEconomical what's the code to remove file extensions???

Profile icon
[deleted]

Why do you want to get rid of the file extension from meme.html? What you have made is a web server using node and it is set up to serve files from the static folder. These files can use hyperlinks rather than javascript code to navigate between pages. For example instead of having the following in an HTML page: <button onclick="window.location.href='news.html'" class="button buttond" id="calm button">Inspiring News | Wholesome News to make your DAY!</button><br />, you can use: <a href="news.html">Inspiring News | Wholesome News to make your DAY!</a>

Profile icon
Purple01Flame

@malvoliothegood because i want to keep it as a blue button, not text

Profile icon
[deleted]

@Purple01Flame You can style a link so it looks just like a button: https://css-tricks.com/css-basics-styling-links-like-boss/

Profile icon
Purple01Flame