6. Making a custom error page and redirect

In the "public_html" folder on your OUCS webspace, create a folder called "error"

In this folder, create a new html file, and put in the META tag to redirect to the new URL, e.g.:

<html>
<head>
<META http-equiv="refresh" content="0;url=http://www.my-new-site.com/">
</head>
<body>
This site has moved. If you do not get redirected to our new site, click <a href="http://www.my-new-site.com">here</a>.
</body>
</html>

Save this file as "error404.html" in the "error" folder under "public_html"

Go back up to the "public_html" folder, and create a file named .htaccess, with the following line in it:

ErrorDocument 404 /~USERNAME/error/error404.html

This redirects the browser to the error page you created above, which in turns redirects the browser to your new site. You have to include /~USERNAME (which is your Oxford username) because the .htaccess file needs absolute paths, and the Oxford username is part of this.

Internet Explorer by default displays "Friendly HTTP Error Messages" if the content of your custom error message is less than 512 bytes. So, in the example above you must make sure the page size is greater than 512 bytes. One way would be to add a suitably sized graphic.

Up: Contents Previous: 5. What about restricting access by username/password? Next: 7. How can I set up a feedback form?