What I am looking to do is create a custom error page. Something so that if a user try's to navigate somewhere that does not exist they get a site error page. Let me give you and example..

http://templatemonster.com/jimmyhoffa.html

or

http://templatemonster.com/browneye.html

Obviously neither of those pages exist but instead of getting the browser's error page they get Template Monster's custom error page. How is this accomplished?

You need access to your .htaccess file.

ErrorDocument 404 /error.html

1. Open Notepad.
2. Save as a regular text file (for example: file.txt).
3. Upload the file to your server and rename it to .htaccess (not file.htaccess, simply .htaccess.
)
4. Open the .htaccess file.
5. Write these two lines into your document:
ErrorDocument 404 http://your-site.com/error.html
ErrorDocument 403 http://your-site.com/error.html
6. Create a new html document and save it as error.html.
7. Upload it to your server - that's it!

OK, it's actually simple.
create a file called
htaccess.txt

In it type:

<File .htaccess>
order allow,deny
deny from all 
</Files> 
ErrorDocument 404 http://yourdomainname.com/error.html
ErrorDocument 403 http://yourdomainname.com/error.html

The first bit inside the File tag says that no one can view that file. The last part says to redirect to those to website incase of a 404 or 403 error. replace yourdomainname.com with the name of your domain. Now, create a file called error.html that will be your error page
Now upload to your server, and you are good to go!

Thanks for all the solutions, got it now. Had no idea it was that easy! Guess you learn something every day ;)

Hate to double post but it won't let me edit. Just wanted to mention that if you're coding this Romil wrote it:

order allow,deny

That actually locks out your whole site, had a mild heart attack for a second. It should be written:

order deny,allow

Other than that mistype it now appears to be working great. Thanks again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.