Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Redirect 404 as permanent, with www to non www


jd01 - 2:45 pm on Oct 3, 2009 (gmt 0)


What do you mean by lose? Where do they go? The page served should be exactly the same as what you see on the screen when you access the error page URL directly... Only the code served to the browser changes, so I'm not sure how you are losing images or files if they are present when you visit the page.

I figured the answer to this one out... The only possibility I can think of is you're using directory relative URLs as links, which is not the best idea... It's best to use server relative links, or absolute links. (You could also be using some version of .. which is about the same a directory relative and not recommended.)

Here are the differences:

Directory Relative:
the/path/to/the/file.html

Starts from the directory you are in:
So if you are viewing http://www.example.com/test/ the directory relative link above will attempt to take you to:

http://www.example.com/test/the/path/to/the/file.html

Server Relative:
/the/path/to/the/file.html

Starts from the server root:
So if you are viewing http://www.example.com/test/ the server relative link above will attempt to take you to:

http://www.example.com/the/path/to/the/file.html

(The same as below... The last two make it so your links always work, even if you move a page from one directory to another. The reason you are not seeing your graphics (my guess) is your are trying to view a page with directory relative links on the domain root as a 404 error page at http://www.example.com/error/test.html which means your server starts looking for the file located @ http://www.example.com/the-file.css in the directory /error/ or in long hand: http://www.example.com/error/the-file.css )

Absolute:
http://www.example.com/the/path/to/the/file.html

Either of the second two are recommended and if you opt for Server Relative, the a base href is also recommended as a general rule on linking.


Thread source:: http://www.webmasterworld.com/apache/4000247.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com