Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi Basically my setup is as follows root >> Home >> products>> a product.
The url structure looks likes this http://localhost/sitename/our-products for a list of all the products which displays correctly however when i go through to the actual product http://localhost/sitename/our-products/temporary-product-1/ no images styling or js is shown.This occurs on every sub page, even under the about section
My images css and js are all in the root level of the site i.e in a css folder under sitename etc. And is called in the masterpage like so <link rel="stylesheet" href="css/styles.css" type="text/css" />
Any ideas why its not showing correctly?
It's because you're using a relative path for the CSS/images/etc. So it's actually looking for http://localhost/sitename/our-products/temporary-product-1/css/styles.css instead of http://localhost/css/styles.css
Prefix your paths with a "/" to make them start from the root. IE href="/css/styles.css"
Or, I think "~/" might be the new way of doing it, since 4.5 can run in virtual directories.
-Tom
Hi Tom, that's what i intially thought, so i tried it and it doesn't work. BTW I am running in a virtual directory.
Did you try "~/css/styles.css"? Or as a quick fix you could try "/virtual-directory-name/css/styles.css"
If not try running an HTTP Capture tool like Fiddler to see where the browser is actually looking for the files and whether or not it's finding them
Hi Tom, Yup i did try it out, Firebug it telling me it pointing to http://localhost/sitename/our-products/~/css/styles.css,
The only way its working so far is ../css/styles.css but then any page above it doesn't work
Even "/sitename/css/styles.css" doesnt work? In that case I'm kinda stumped, sorry :(
What is the path of your root page and the path of one of the subpages where it isn't working?
@kipusoep http://localhost/sitename/our-products.aspx and http://localhost/sitename/our-products/temporaryproduct.aspx
Tom's last post should work: /sitename/css/styles.css
If it doesn't, look with firebug where it's looking in the Net tab, then select CSS tab underneath and post the full url here...
@Tom sorry i missed your post saying using /sitename/css/styles.css, it worked after clearing my cache. Thanks guys
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
CSS/JS/images not showing a level below the root level
Hi Basically my setup is as follows root >> Home >> products>> a product.
The url structure looks likes this http://localhost/sitename/our-products for a list of all the products which displays correctly however when i go through to the actual product http://localhost/sitename/our-products/temporary-product-1/ no images styling or js is shown.This occurs on every sub page, even under the about section
My images css and js are all in the root level of the site i.e in a css folder under sitename etc. And is called in the masterpage like so <link rel="stylesheet" href="css/styles.css" type="text/css" />
Any ideas why its not showing correctly?
It's because you're using a relative path for the CSS/images/etc. So it's actually looking for http://localhost/sitename/our-products/temporary-product-1/css/styles.css instead of http://localhost/css/styles.css
Prefix your paths with a "/" to make them start from the root. IE href="/css/styles.css"
Or, I think "~/" might be the new way of doing it, since 4.5 can run in virtual directories.
-Tom
Hi Tom, that's what i intially thought, so i tried it and it doesn't work. BTW I am running in a virtual directory.
Did you try "~/css/styles.css"? Or as a quick fix you could try "/virtual-directory-name/css/styles.css"
If not try running an HTTP Capture tool like Fiddler to see where the browser is actually looking for the files and whether or not it's finding them
Hi Tom, Yup i did try it out, Firebug it telling me it pointing to http://localhost/sitename/our-products/~/css/styles.css,
The only way its working so far is ../css/styles.css but then any page above it doesn't work
Even "/sitename/css/styles.css" doesnt work? In that case I'm kinda stumped, sorry :(
What is the path of your root page and the path of one of the subpages where it isn't working?
@kipusoep http://localhost/sitename/our-products.aspx and http://localhost/sitename/our-products/temporaryproduct.aspx
Tom's last post should work: /sitename/css/styles.css
If it doesn't, look with firebug where it's looking in the Net tab, then select CSS tab underneath and post the full url here...
@Tom sorry i missed your post saying using /sitename/css/styles.css, it worked after clearing my cache. Thanks guys
is working on a reply...