Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
September 02, 2010, 07:27:24 AM

Pages: [1]   Go Down
  Print  
Author Topic: simple 404 page  (Read 243 times)
durangod
Intergalactic Superstar
*****
Offline Offline

Posts: 187


« on: February 01, 2010, 09:43:49 AM »

hi i am getting some 404 errors at times, some days its fine and nothing and some days i get a few, i understand that its normal to get some at times, not much you can do about that and at times it could be a typo on the part of the user, but i thought just to handle it i could do a simple 404 page just in case for each site domain..  

what i am getting is file not found from dif sites but they are all common in that it is 404.shtml   << shtml extension even on the sites where they are all html..

i just need to know do i understand this correctly...

in each htaccess file for each domain and sub domain i need to put this line in

ErrorDocument 404 / 404.html    and then make a 404.html file in each subdomain to go with that, or do i need to make both.. 404.html and 404.shtml...   will one suffice..  and is my  mindset correct on that process.

UPDATE-- i just went thru and set up all my subdomains with their own 404 and added that line to each htaccess and its working great, this should handl the shtml also correct..   lol nevermind tested and ansered my own question lol, thanks

« Last Edit: February 01, 2010, 10:33:13 AM by durangod » Logged
MrPhil
Professor in Nanotechnology
*****
Offline Offline

Posts: 4800



« Reply #1 on: February 01, 2010, 11:13:10 AM »

Apache servers have a very strange quirk. If you have an error, they will first attempt to find your custom error document (handler), such as /404.shtml or anything you defined with an ErrorDocument 404 /filename. So far so good, but if it doesn't find your handler, it logs its inability to find your handler as a 404! So, you get two errors logged instead of one.

You need to create your own set of error documents (error handlers). The easiest is (in cPanel) to click on the Error pages button and create the basic set /400.shtml, /401.shtml, /403.shtml, /404.shtml, and /500.shtml. No need to put anything in .htaccess. You need to add some code around what they give you to set colors, font, show the name of your site, contact information, sitemap and homepage links, etc. Just keep it simple so that it's not likely to cause a 404 itself. I tried to attach the /404.shtml file I use, but the LF server is broken (directory not writable).

You are free to put your error documents elsewhere (than /) or with different names or types (e.g., /errors/error404.html), but then you need the .htaccess entries for them.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to: