So I start a static web project on eclipse. Let's say MySite. And then I start a jetty web server on eclipse and open localhost:8080 on my browser.
This is what I'll see:
Error 404 - Not Found
No context on this server matched or handled this request.
Contexts known to this server are:
MySite(/MySite)
So I go to localhost:8080/MySite/index.html
and see my homepage... except the css/js files are not loaded and the links don't work.
That's all because of the relative paths. css/main.css
directs to localhost:8080/css/main.css
while it should direct to localhost:8080/MySite/main.css
How to fix this without using a workaround?
Aucun commentaire:
Enregistrer un commentaire