Eclipse static web project HTTP Preview/Server module conflicts with relative paths

Viewed 1260

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:

Main HTTP Preview Page

So I go to localhost:8080/MySite/index.html and see my homepage.

Home Page

As you can see the the link is not leading where it should be. It should be going to localhost:8080/MySite/index.html, or even more preferable, MySite's index page should be hosted on localhost:8080/index.html and not on some module.

index.html

<!DOCTYPE html>
<html lang="en">
    <body>
        <a href="/index.html">Home</a>
    </body>
</html>

If I were to change this to MySite/index.html it defeats the purpose of it being an http preview server, because MySite will eventually be it's own site and not some kind of module.

How to fix this without using a workaround?

3 Answers
Related