site root relative url

George Andrews 1 Reputation point
2021-11-20T15:50:55.703+00:00

I have set IIS 10 (win 11) to test a local site where paths are relative to site root, e.g. /folder/file.html
When I open the home page in a browser, located at http://localhost/asmatron/ and click a link in there, structured like

<a href="/folder/file.html">a page</a>

I get a 404 error because the url IIS is looking for is http://localhost/folder/file.html

instead of http://localhost/asmatron/folder/file.html

Am I missing some setting in IIS or what?

Internet Information Services
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,771 Reputation points
    2021-11-20T16:09:44.457+00:00

    That is how urls work. If they start with a “/“ then they are from the root, if not they are relative. The browser does this.

    0 comments No comments

  2. George Andrews 1 Reputation point
    2021-11-20T16:27:54.713+00:00

    Does that mean that my localsite's root is localhost and not localhost/asmatron?

    0 comments No comments