I typically refer to any assets on my site using absolute path so that I don't have to worry about the location of the assets relative to current file.
<!-- Using a absolute path. -->
<img src="/images/flag.png" />
<!-- Using a relative path. -->
<img src="../../../images/flag.png" />
However, this time I need to host the site at a non-root location e.g. http://my-server.com/holiday/
.
How would I go about this? I am looking for a solution that doesn't require me to change the path in my files. How do I configure the server (Apache) to treat http://my-server.com/holiday/
as a "root"?
Clarification:
I still need http://my-server.com/
to behave "normally". That is, it should still point to http://my-server.com/index.html
i.e. doesn't get redirected to http://my-server.com/holiday/
.
what about using html's BASE element? http://www.w3.org/TR/html4/struct/links.html#h-12.4
although i´m not sure how you could have it in a single html file and inherit it to the rest of your htmls, so your source remains intact. if your site is html-only maybe with frames, otherwise you could use some sort of server-side include depending on what youre using (asp, jsp, whatever). Check out this link for more information http://www.boutell.com/newfaq/creating/include.html
EDIT:
Of course it would work in case you do with php. Adding: