homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Cannot Find StyleSheet
When linking from another page

5+ Year Member

Msg#: 4157241 posted 12:08 am on Jun 23, 2010 (gmt 0)

When I type in the url directly, the stylesheet is found and the page shows correctly. But if I click on a link from another page of the website to the same url I typed-in, it isn't finding the stylesheet and the page isn't showing correctly. What could be causing this?



WebmasterWorld Senior Member

Msg#: 4157241 posted 12:29 am on Jun 23, 2010 (gmt 0)

I'm assuming this is a site you are working on and making changes to then testing them so -- try clearing your cache to get the fresh version?


5+ Year Member

Msg#: 4157241 posted 1:01 am on Jun 23, 2010 (gmt 0)

You assume correctly :) But still the same problem :(


WebmasterWorld Senior Member

Msg#: 4157241 posted 2:17 am on Jun 23, 2010 (gmt 0)

How about this...the links you are clicking on from other pages are actual links to the live version of the site rather than the development version. Such as this...

Maybe you are working on dev server localhost/subpage.html but click on a link that is actually coded to the live site www.example.com/subpage.html so you are seeing the live version rather than the dev version -- hehehe, not that I have had that happen to me :p


Msg#: 4157241 posted 2:25 pm on Jun 23, 2010 (gmt 0)

Always clear your cache and do a hard refresh (Ctrl + F5) several times to eliminate any possibility of an old cached page being the problem.

If you have used relative paths for your links, you must be sure that you are telling the browser how many directories to backup to and then down to find the file. This is only important if files are in different folders which means you have a more complex directory structure. Absolute paths to folders/files is ok, but relative paths work just fine.

Too bad they don't allow URLs to sites so we can look at the problem page(s).


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4157241 posted 7:17 pm on Jun 23, 2010 (gmt 0)

Relative paths *work* but they always seem to bring up problems like this. If you have


You have to have


respectively. Two different links for the same file. But if you use


in both files, you have both consistency and ease of maintenance, no need to remember how many toothpicks get you back to home. :-) So that's the first thing, adopt this usage when uploading and many of these will go away. Down-side: it doesn't work offline, your computer is not (usually) a web server and has no document root.

O.T.: As for versioning issues ("I updated the style sheet, changes aren't showing") this is often a combination of browser specific issues and the caching settings of the server, both eliminated (well, worked around) by an old trick. Leave your stylesheet file name the same, but use a query string:


Change the bolded portion every time you upload, this will trick the browser into thinking it's a new file and will always download the style sheet. Of course this is not something you'd want to do site-wide, just while making mods to specific pages, but it speeds up your development.


5+ Year Member

Msg#: 4157241 posted 12:22 am on Jun 24, 2010 (gmt 0)

OK. I found the problem. I had a trailing backslash after the filename, ie: http://example.com/filename.php/. Removing the backslash solved the problem. Thanks for all your comments.

[edited by: tedster at 3:02 am (utc) on Jun 24, 2010]
[edit reason] Switched to example.com to make the URL more readable [/edit]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved