Web Design All-in-One For Dummies, 2nd Edition
Book image
Explore Book Buy On Amazon

Next, you need to edit the existing .htaccess file on your web server (if one already exists) or create a new one. An .htaccess file is a hypertext file that provides directives to the server, such as password protection and serving error pages.

This file needs to sit at the root level of your host directory to provide instructions to the server on how to serve up your new custom documents should either of these errors occur.

To see whether your server already has an .htaccess file, establish a remote connection to your server using your FTP client and take a look at the root level of your host server.

If an .htaccess file already exists, download (get) a copy of it to your local computer so that you can make modifications to it. If you don’t see an .htaccess file at the root level, create a new one.

In Dreamweaver, .htaccess files are often hidden or invisible in the Files panel. To reveal these hidden files, click the Options menu in the upper-right corner of the Files panel, choose View, then choose Show Hidden Files.

To create an .htaccess file, follow these steps:

  1. Open a text editor, such as Notepad or TextEdit, and type in the following two lines of code:

    ErrorDocument 404 /error404.html
    ErrorDocument 401 /error401.html
  2. Save the file as htaccess.txt to the root level of your local site.

  3. Establish a connection between your host server and your FTP client, and upload a copy of the htaccess.txt file to the root level of your host server.

  4. While still connected to the remote server, change the name of the htaccess.txt file on the remote server to .htaccess by removing the .txt extension and placing a period before the filename.

  5. Upload your customized error401.html and error404.html files to the root level of your host server.

The final step, after creating your custom error pages and uploading them to the root level of your remote server, is to contact your host provider for further instructions on how to make these new files replace the server’s default error message pages. The host provider typically needs to configure some software on the server end before the new pages will work.

The provider might also request that you log on to your site’s control panel or site utility and make some adjustments to your site’s configuration.

About This Article

This article is from the book:

About the book author:

Sue Jenkins is a working designer as well as a design trainer and author. Her design firm, Luckychair, provides design services for web, logo, and print. Sue has also created a series of training DVDs on popular Adobe design tools including Photoshop, Dreamweaver, and Illustrator.

This article can be found in the category: