Add custom 404 page on DreamHost

Source here.

Gail’s Tutorial on Customized Error Messages

While the other things listed here work, I like all my custom error messages in a single directory. If that is what you want, read on. All stuff in parens are the shell commands to do what I’ve told you to do.

1. Create a file in the root directory of your web server named .htaccess that contains:

ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html

and make sure that the protection on the file allows world read access (chmod 644 .htaccess). NOTE: Most web browsers won’t let you look at .htaccess, even though it has world read permission.

2. Create a directory named errors (mkdir errors) and set the protections to world read/execute (chmod 755 errors)

3. Inside that directory, create

400.html
401.html
403.html
404.html

and make sure they are world readable (chmod 644 *.html, if you are in that directory)

These files should explain to the user what the error message means in plain English. It is also a good idea to give them pointers to at least your home page and possibly to the most popular pages on your site. Go to: http://www.yoga4good.com/errors/ to see the ones on one of my sites.

4. Test them out by triggering the error codes.

If you have problems, you can always check your error.log to see what errors are being generated.

Hope this helps!

Gail

========

May also look at this from wiki.dreamhost.com.

-EOF-

Advertisements

5 thoughts on “Add custom 404 page on DreamHost

  1. .htaccess file, what a powerful weapon for webmaster. It can rewrite rules, 301 redirect url, deny ip, provide hotlink protection, make default cache for any kind of file and password authorization for every single site on VPS. Glad you found that powerful weapon 🙂
    —your twitter follower

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s