SearchEngineChannel

Looking for somewhere to host your site? Browse our PHP web hosts section!

Home > Tutorials > Custom error pages using .htaccess

Custom error pages using .htaccess

Quick jump:
Introduction
Create the .htaccess file
Create the 404 error page
Trying it out
Taking it further

Create the 404 page

Now you need to create the 404 page. Make a new web page called "error404.htm" and enter "This is my 404 page". Enter it a few dozen times, as Internet Explorer won't display it unless the file is over 512 bytes.

Once it's done, login to your webspace with your FTP client, and create a new folder called "errordocs". Upload the file "error404.htm" to this directory. Upload "htaccess.txt" to the root of your webspace and rename it to ".htaccess" — there's no .txt at the end, no name in front, just ".htaccess". If the file seems to vanish don't worry, some FTP clients don't display it — the file's still there.

Next page: Trying it out