Skip to content

2020Servers

Home Contact Us Webmail
 

Newsflash

Free Windows Server 2008 on Virtual and Dedicated server plans
 
You are here: Home arrow Tools arrow Using Your Account arrow Redirecting Error Pages
Redirecting Error Pages Print E-mail

Redirecting Error Pages

This page describes how to customise the error messages that appear when someone follows a link to a page that does not exist, as well as other common errors. By dropping a file called .htaccess in the root directory as shown in the example, every time one of these error pages is called, a page of your creation will be shown instead.

.htaccess:
AuthName 2020MEDIA
AuthType Basic
errordocument 404 /errors/err404.html

errordocument 500 /errors/err500.html

And so on for other pages. Click here for a full list of error pages. In the example above, the error pages would be found in a directory called 'errors', but it is up to you to call them whatever you want.
The .htaccess file is a plain text file, without any extension like .txt or .doc. It must be uploaded as ASCI - this is the default for most FTP programmes. Upload the file into the root directory ( also called the 'home' directory) and then attempt to view a page you know doesn't exist. You should get the page you created instead of the usual 'HTTP 404 Page does not exist' page. Once on the server its likely you won't be able to see the .htaccess file as it is a hidden file. You could rename the .htaccess.txt for editing purposes and then back to just .htaccess to enable them.

If you have read the page about password protecting pages, don't include the bit about AuthUserFile as it will password protect your entire website! Also, don't redirect 401 errors - this is used for password protecting of directories.

For further information consult any of the many books on Apache Web server, or see http://www.apache.org.

Final Tip:
See also Password Protecting Pages for more on htaccess.

Notes:
1 You can redirect any http code.
2 Links can be relative or absolute.
3 The AuthName must not include spaces. It 2020 Media is not allowed.
4 The .htaccess file should be placed in the highest level direcory and it's
action will affect all lower directories unless there is another .htacess file to override them.
5 The file must be in unix text format. Dos text will not work. Be sure to
upload using ASCI mode in your ftp client.
 
< Prev   Next >
Advertisement

From the Blog

2020Media.com Blog
[+]
  • Narrow screen resolution
  • Wide screen resolution
  • Auto width resolution
  • Increase font size
  • Decrease font size
  • Default font size