Changing 404 error.

They have: 45 posts

Joined: Feb 2002

How do you change the 404 (and the others) error pages?

This can be done, I've seen it on Gamespy.com and other sites, but I've never been able to figure it out.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

You'll use the ErrorDocument directive in the .htaccess file.

Syntax:
ErrorDocument 404 /404.html

They have: 4 posts

Joined: Apr 2002

Is there any reason not to use the full URL path to the 404.html?

ErrorDocument 404 http://www.somesite.com/404.html

The reason I'm asking is that I'm not entirely sure that the /404.html may be interpreted properly by some configurations, especially in subdirectories.

Artur
eBoundHost Support
Web Hosting: $9.95
Dedicated: $99.95

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Quote: Originally posted by Artur
Is there any reason not to use the full URL path to the 404.html?

ErrorDocument 404 http://www.somesite.com/404.html

The reason I'm asking is that I'm not entirely sure that the /404.html may be interpreted properly by some configurations, especially in subdirectories.

It is just not necessary to use the full path. The / tells the server to look for it in the root web directory. If you had sub-domains, then you would have to use the full path.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Check the documentation as well. For some error messages you have to use the full url, for others you cannot use it at all.

Also, some spiders can get caught in a 404 error page if you use a relative CSS link, so if you do create custom error pages, you might want to use absolute urls for the CSS.

They have: 45 posts

Joined: Feb 2002

Okay thanks.

They have: 133 posts

Joined: Sep 2000

that can't be done with IIS5, is that correct? Or is there a way?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

It can be done with IIS5.

Go to the website properties through MMC, then choose the "Custom Errors" (:eek: Laughing out loud) tab. From there you can select what error pages you want to customize (i.e. 500, 404 etc) and click Edit Properties, then select your file. Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.