Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

[Tutorial] Custom Error Pages
Started by klubadmin
(2012-10-29 02:31:51)
klubadmin (2012-10-29 02:31:51)
Ever seen one of those nice 404 errors you get when you go to a page that no longer exists (or never did)? Ever want your own? Here's how the pros do it:

Step 1 - Create the page
Simply create a .html or .php file that looks pretty and lets the viewer know that they went to a nonexistent page and that they got a 404. Save it as something easy, like "404.html".

Step 2 - Create .htaccess
Now, some hosts may have disabled editing (or creating) this file, so check with you host if you can do this (however most hosts are fine). In the /public_html/ folder, create (if it doesn't exist) a file called .htaccess and make sure to spell it correctly.

Step 3 - Edit .htaccess
Go inside .htaccess and add:
Source Code
ErrorDocument 404 /404.html

This tells the website that a 404 error should display the page "404.html" whenever it's triggered. Likewise, the same can be done for other errors, simply by replacing "404" with the error number.

And that's it! Have fun making your errors look pretty now!

This post has been edited one or more times, the last time was:
2012-10-29 02:34:07

socialcu.be
3dsklub.cf

Like what I said? +respect
>Official Trinate Spriter<
NINTENDO64 (2012-10-30 00:32:39)
Or you coud just make a 404.shtml file
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
klubadmin (2012-10-30 02:50:48)
@NINTENDO64 Unless the host has a special feature that detects that file, that won't work.
socialcu.be
3dsklub.cf

Like what I said? +respect
>Official Trinate Spriter<
klubadmin (2012-11-07 02:44:08)
Uh, yeah...
socialcu.be
3dsklub.cf

Like what I said? +respect
>Official Trinate Spriter<
klubadmin (2012-11-07 19:50:59)
Thanks.
socialcu.be
3dsklub.cf

Like what I said? +respect
>Official Trinate Spriter<
 

Log in to submit a comment

This topic's ID: 34874

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)




Total registered users: 8321
New registered users today: 7
Newest registered user: ElegantVulpes

©  Copyright 2026 3DSPlaza. All Rights Reserved