View Full Version : .htaccess 404 error page
Winterworks
02-21-2009, 10:50 AM
I want something like...
http://batzempire.com/404/index.php
So if you go to a page that doesn't exist, it shows up as a page like that. (BatzEmpire is not my site, I'm using it as an example).. so how can I make a .htaccess file first of all? And then, what can I put in it to make it show a 404 page, and how do I make the 404 page?
Dismounted
02-21-2009, 11:23 AM
Use the ErrorDocument directive (http://httpd.apache.org/docs/2.2/mod/core.html#errordocument).
vbplusme
02-21-2009, 11:30 AM
This is the .htaccess code that tells the server where to find the documents.
# custom error documents
ErrorDocument 401 /401.shtml
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml
You just create a standard html page with the message you want and name it per the naming structure in the .htaccess file. The error documents in this care are in the root with the .htaccess file. I am pretty sure that page you are referencing was done with cPanel utility. If you have cPanel, got to the error pages in the advanced features. It contains the templates you can use to make the error documents.
HTH
Winterworks
02-21-2009, 12:07 PM
How do I make a .htaccess page...?
I made a .txt file called .htaccess, with nothing else, and when I uploaded it, it simply disappeared.. It doesn't show up in the FTP, and when I view a unknown page, it won't show the error.
vbplusme
02-21-2009, 12:30 PM
That's because on unix its SUPPOSE to be an invisible file. Your server must be configure to enforce that but usually you can see them in ftp, you should check your client to see if it has a "display invisible files" parameter and enable it.
Often people work on .htaccess file locally and call them htaccess.txt to avoid complication with operating systems like windows when it doesn't like a file with no name and only an extension.
Actually, you have it backwards, you should make the error pages first so you know for sure what to put in the .htaccess file.
Forgot to ask, do you have access to cPanel?
Winterworks
02-21-2009, 12:36 PM
Yes I do have access to cPanel. Thank you for helping.
firstrebel
02-21-2009, 05:52 PM
If you check your web site access logs with something like Awstats then setting up a 404 with htaccess may not show any 'pages not found'. This is a known issue.
Bob
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.