I use absolute paths for links to resources like css, images and javascript. So, in <head> of index.html , I have something like this:
<link href="/assets/css/style.css" rel="stylesheet">
Assuming my project directory is as follows:
- index.html
- assets /
- css /
--- style.css
This works fine on my local web server, where I install the document root in this directory using the <virtualhost> directive. But when I put this in a webserver subdirectory (e.g. http://www.example.com/subdirectory/ ), it no longer finds assets when accessing http://www.example.com/subdirectory/index.html .
How can I solve this without using relative paths in index.html ? Can this be done using a .htaccess file in a subdirectory? If so, how?
Edit
There are other folders at the root level of the web server that should not be affected by the redirection that occurs for /subdirectory/
source share