Removing File Extensions from Website URLs in Replit

44 Views Asked by At

So I want to make my website url https://games.hollodev.repl.co/home.html into https://games.hollodev.repl.co/home how do I do this?

1

There are 1 best solutions below

0
On

You would typically want to use some kind of simple backend like express or flask.

For example if you were to use express in node.js

const express = require('express');
const app = express();

// '/home' route would render your html file.
app.get('/home', (req, res) => {
  res.sendFile(__dirname + '/home.html');
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});