I have a problem because i can´t work my images or css when my site is like http://www.site.com/shop
Situation:
I have these folders inc img css js
In my root documents i have and in this include i have all the styles.css, scripts and metadata.
So far so good, all the documents work when they are in root document but now i have a new folder called shop where i am putting code to make a store.
mysite/shop
How can i call from the shop/index.php all my images, and css, js and inc ?
I want to avoid using ../img/bla.jpg or ../inc/header.php also because when i include the footer or menu i can´t find the images.
Thanks for all the help.
A direct way to access those from HTML would be to provide the / absolute path that refers to the root of your site ie
http://mysite.com/. For example:<img src="/img/image.jpg"/>would point to a folderhttp://mysite.com/img/image.jpgno matter what your current url structure is.There are some (quite common) pitfalls of using this inside server-side PHP to reference files from the root of your site(it will try to read files from the root of your drive on UNIX systems for example) but inside client-side HTML code the absolute root
/works like a charm, getting the righthttp://mysite.com/absolute path.