Graphics and fonts not showing when page not at root of site
My site is www.holmpc.co.uk . I have a 404 page which works fine for pages at the root of the site ( for example, try www.holmpc.co.uk/fghj ).
I also have a blog hosted on the site, at www.holmpc.co.uk/blog . Unfound pages at this level (for example try www.holmpc.co.uk/blog/fghj ) show the 404 page, but none of the font information seems to be picked up, and none of the graphics (except those hosted elsewhere on the net like the twitter button) show up.
It seems to me as though these pictures and the font information must be held at the root of the site and referred to with relative paths. Is there a way round this?
Re: Graphics and fonts not showing when page not at root of site
Welcome to TalkGraphics
I haven't a clue but check back frequently. I am sure one of the more savvy members will have a solution.
Re: Graphics and fonts not showing when page not at root of site
When you view the source for the url:
http://www.holmpc.co.uk/blog/fghj
It is looking for a /blog/index_htm_files for the supporting files:
<link rel="stylesheet" type="text/css" href="index_htm_files/xr_main.css"/> <link rel="stylesheet" type="text/css" href="index_htm_files/xr_text.css"/> <link rel="shortcut icon" href="index_htm_files/favicon.ico"/> <link rel="icon" type="image/vnd.microsoft.icon" href="index_htm_files/favicon.ico"/> <link rel="icon" type="image/png" href="index_htm_files/favicon.png"/> <script type="text/javascript" src="index_htm_files/roe.js"></script> but that directly only seems to exist in your root folderI suspect if you edit the location by just putting a forward slash in front of the links, the page will start showing as expected, like:
<link rel="stylesheet" type="text/css" href="/index_htm_files/xr_main.css"/>
Re: Graphics and fonts not showing when page not at root of site
Yes, that's right. So using this method to serve a 404 page only works for attempts to view pages on the same level as the index_htm_files folder. If a user attempts to access a page in another folder (whether it exists or not) then the 404 page is not displayed correctly.
Xara support have told me (in response to a ticket about this problem) that I need to use this method to implement my 404 page:
> Yes, create a single 404 page and then either in your website config
> file (on the web server - if you have access to it) change the
> ErrorDocument 404 path, or you specify this in the .htaccess file.
> http://www.javascriptkit.com/howto/htaccess2.shtml
but this is exactly what i'm doing, and has the problem i've already described. What they didn't say, but I have now worked out, is that I need to put the whole url of the not found page into the .htaccess file.
Now that the ErrorDocument 404 property in that file is http://www.holmpc.co.uk/notfound.hmtl all is working as I want it to.