when i write localhost/profil the css works. But when i write localhost/profil/ the css doesn't work.
app.use(express.static(__dirname+'/public'));
app.get('/profil',[checkCo],require('./routes/profil.js'));
Why?
thanks!
edit:
it's because it thinks that profil/ is a folder, so how can i get around this?
You likely need to use absolute paths within your HTML.
For example, instead of
<link rel="stylesheet" href="style.css">
you need to do
<link rel="stylesheet" href="/style.css">
In the first example, the browser tries to access style.css
in the current directory the user is navigated to. So if the user is navigated to /profil/
, it tries to load the css from /profil/style.css
. In the second example, the browser is told to load the css from /style.css
no matter what.