Help with file location in href and root directory


I am having trouble with my includes file.

I have my CSS and HTML files separated into two files with my HTML file being called by the index.php file when accessing local host/directory name on my Linux server.

However, when I try to access this same file using the same URL from a different directory, the CSS file included in the HTML link rel command does not load.

I have tried various combinations of / and …/ etc but it seems to only work from one directory… not any directory.

I can call the HTML file from anywhere consistently, but the CSS file linked to the HTML file seems to fall over.


I assume the php file has an include that calls the html.
If so, the css file should be relative to the php file (or the url you are visiting), regardless of where the html file is.
Unless you use an absolute path for the css.

1 Like

Thx yes I see it has to be called relative to the calling. Thx!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.