html - Eclipse static web project HTTP Preview/Server module conflicts with relative paths -
so start static web project on eclipse. let's mysite. , start jetty web server on eclipse , open localhost:8080 on browser.
this i'll see:
so go localhost:8080/mysite/index.html
, see homepage.
as can see the link not leading should be. should going localhost:8080/mysite/index.html
, or more preferable, mysite's index page should hosted on localhost:8080/index.html
, not on module.
index.html
<!doctype html> <html lang="en"> <body> <a href="/index.html">home</a> </body> </html>
if change mysite/index.html defeats purpose of being http preview server, because mysite it's own site , not kind of module.
how fix without using workaround?
as can see the link not leading should be. should going localhost:8080/mysite/index.html, instead goes localhost:8080/index.html
that because using url form relative server's root /
.
simply use ./
(page-relative path) instead of /
(server-root-relative path) in mysite/index.html
.
<!doctype html> <html lang="en"> <body> <a href="./index.html">home</a> </body> </html>
hope helps!
Comments
Post a Comment