Web Developer 404/401 Errors
Languages Assistance The Developer
Description
    This tutorial shows you how to setup your website server to redirect Page Not Found (404) and Access Denied (401) error to a personalized webpage.
  •  
  • Difficulty: Medium, Need a good understanding of file manipulation.
Instructions
  1. Create a simple HTML file to test if your server accepts 404/401 redirection (A page with text that says "okay" is sufficent).
  2. Now you need to create a .htaccess file. Open Notepad or SimpleText and create a new file named "#.htaccess". If you are using a webpage editor such as Dreamweaver create a new file on your server named ".htaccess". Dreamweaver users can skip step 5.
  3. Insert these lines into the new document and replace the HTML URL's with your own test pages.
    ErrorDocument 404 /my_404_page.htm
    ErrorDocument 401 /my_401_page.htm
  4. Upload the test files and the "#.htaccess" file to your server.
  5. Rename the file "#.htaccess" on your server. Remove the "#" in front of the filename.
  6. Test if your server accepts 404/401 redirection by going to a falsified internet URL (e.g. http://yoursite.com/doesnotexist.htm)
    If your test page appears, continue this tutorial.

    If a standard page not found page appears, do not continue with this tutorial. Your website server does not support .htaccess files.
  7. Now create the custom files that you will use to redirect users. Keep in mind that a 401 Page Error is a forbibben page and a 404 Page error is a page that wasn't found.
  8. Change the internet addresses as neccessary in the .htaccess file
  9. Upload the files to your server.
Additional Resources
HomeView IndexGo to Top

Creative Commons License
This work by http://webdeveloper.50webs.com is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.