Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Custom 404 Error Page

There's a CityDesk News article about creating custom 404 error pages which says one is in use at FogCreek and yet if a cause a 404 by mis-typing a FogCreek URL, I get the default IE page. What gives?

Article reference:

http://www.fogcreek.com/CityDesk/news/entries/2002/October/22.html

John Topley
Wednesday, October 23, 2002

You're right... fogcreek does not have a custom 404 page working.

Anyway, there is a major reason Citydesk is currently NOT ok for generating 404 pages. That is the relative addressing, which fails for a 404 page, since the page is loaded from a diffent location as it is generated for. This is of course only a problem if you use images, style sheets or scripts using magic names.

Adriaan van den Brand
Wednesday, October 23, 2002

Oops.  That was on oversight which I just fixed.

It was working fine on www.joelonsoftware.com and discuss.fogcreek.com, but somehow got broken on www.fogcreek.com.  Anyway, thanks for the pointer!

Michael H. Pryor
Wednesday, October 23, 2002

PS.  We use CityDesk to publish all of our sites, including www.fogcreek.com and www.joelonsoftware.com, so CityDesk is perfectly fine for generating 404 error pages.  You are correct though, that your 404 page can't use relative references, but this isn't CD's fault.  This is the case no matter what you use... You just have to keep that in mind when you build your 404 page.

Michael H. Pryor
Wednesday, October 23, 2002

I like the 404 article, but maybe I didn't read it closely enough.  I use dreamhost.com.  It will throw 404's to a page called "missing.html"
http://tk-jk.net/missing.html

I have so many little sites in subdirectories, I'd like to have a "missing" file in each of those directories so I could narrow down what the surfer is really looking for.  Dreamhost doesn't seem to do that.  Maybe there is another way?

The other thing I don't understand.  Does FogCreek analyze bad urls and create a special 404 page for each one or a redirect to a 404 page?

tk
Wednesday, October 23, 2002

This is related to the server. But I think that if you check the location from javascript, it will reveal the original requested document. From PHP (if enabled in .html documents) it should also be possible to get the requested page.

Check with
<SCRIPT LANGUAGE="JavaScript"><!--
  document.write("<P>Your requested page ", window.location.href," is not available</p>\n");
//-->
</SCRIPT>

in the body. I haven't tested this one, but it should work.

My comment to Michael: I can't choose anything but relative addressing for Citydesk. Or I should create a special template with absolute references, just for the 404 page. This is not my ideal solution. Rather I would like a cityscript tag that forces absolute references for that entire page. Or a property for the article. Or for the publish location...

Adriaan van den Brand
Thursday, October 24, 2002

*  Recent Topics

*  Fog Creek Home