Reputation: 897
I'm building a website locally using Apache, MySQL and PHP. I have different subfolders and I'm trying to give one absolute reference to my css file from my main header.php includes file.
Inside of header.php I have:
<link href="/Users/nicolauria/Sites/sd/css/style.css" type="text/css" rel="stylesheet" />
The css file does not load correctly. Developer tools gives me this message "The requested URL /sd/css/style.css was not found on this server."
Any help is greatly appreciated! Nico
Upvotes: 3
Views: 9738
Reputation: 905
In Which location your header.php file is located? I mean If you have your header.php file in sd folder than use your code like this <link type="text/css" rel="stylesheet" href="css/style.css" />
Maybe this link will help you alot http://www.htmlhelp.com/reference/css/style-html.html
Upvotes: 0
Reputation: 943157
If you want to provide an absolute URI then you must:
file://
)file:
data onto a page loaded via http:
/https:
for security reasonsIt is far, far better to host all the resources you need on the webserver.
Upvotes: 0
Reputation: 360572
You're loading this via HTTP? Then you're bound to use only "http-space" paths, which means you can NOT include the site's document root in urls. e.g.
your site's files are physically on the server in /home/sites/example.com/html
, which is defined as the document root of the site. When you visit the site and request a file, e.g. http://example.com/foo/bar.html
, the web browser will send over:
GET /foo/bar.html
and the webserver will tack on the document root, producing
/home/sites/example.com/html/foo.bar.html
But note that this path applies ONLY within the webserver itself. It will never be accesssible to you in this form. You can only specify directories/files within the site's document root. That means if you requested something like example.com/home/sites/example.com/other/file.html
, you'd force the server to produce /home/sites/example.com/html/home/sites/example.com/other/file.html
, etc...
Upvotes: 3