Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 12-25-2005, 08:11 PM
SKC
HostGator Guest
 
Posts: n/a
Red face custom error pages

Greetings!

I've just purchased an account and uploaded my site, including custom error pages. I've gone to the control panel and see all of my code when I go to the 404 error page, but when I 'test' it by going to http://iphost/~username/test.html (with my actual address inserted), I don't get my custom error page. I've tried saving it as 404.shtml and 404.html -- if I go to http://iphost/~username/404.html the page shows up, but if I type a page that doesn't exist, it doesn't show up.

I'm wondering if I have the pages saved in the wrong directory or something.. wouldn't seem so since the code I imported shows up in the control panel window. I'm just trying to figure out what I need to do to use my custom html error page with my account. I'm trying to get everything in order prior to changing my dns servers.

Thanks!
P.S. I thought about opening a ticket, but thought this is more of a FAQ type issue, but didn't find anything on the topic in the knowledgebase.
Reply With Quote
  #2  
Old 12-25-2005, 10:41 PM
jeff_s jeff_s is offline
Baby Croc
 
Join Date: Feb 2005
Posts: 69
Default Re: custom error pages

I have a 401.shtml and it works. I can't see anything in my .htaccess file that references my 401 file, so maybe it's just the .shtml suffix that it needs?

Sorry if that's not the answer. Somebody will surely have the answer to this once Christmas is over....
Reply With Quote
  #3  
Old 12-26-2005, 03:26 AM
Stef's Avatar
Stef Stef is offline
Royal Croc
 
Join Date: May 2004
Posts: 715
Default Re: custom error pages

There should be an .htaccess file in your documentroot with at least this line:
Code:
ErrorDocument 404 /404.html
Stef.
Reply With Quote
  #4  
Old 12-26-2005, 06:40 AM
TeeJa's Avatar
TeeJa TeeJa is offline
Royal Croc
 
Join Date: Dec 2004
Location: Kerrville, Texas
Posts: 688
Default Re: custom error pages

And another setup.

You can use shtml, html, htm, or PHP as an error page.
I have mine with a 5 sec delay.
Code:
<meta http-equiv="Refresh" content="5;url=http://www.yourdomain.com/">
Bringing it back to the main page.

You can use your imagination as to what to say before the delay sends them back.

Also, if you use the Cpanel to set your error pages, and if you have a canned program you setup for that domain that uses the .htaccess file, it will overwrite it, so you will have to manually edit your .htaccess file.

Here is a sample of my .htaccess file, located in public_html/ on all my accounts. The "SetEnvIfNoCase User-Agent" are unwanted leeching harvesters. This one probably needs updating.

Code:
RewriteEngine On

ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

SetEnvIfNoCase User-Agent "^EmailSiphon" bad_bot
SetEnvIfNoCase User-Agent "^EmailWolf" bad_bot
SetEnvIfNoCase User-Agent "^ExtractorPro" bad_bot
SetEnvIfNoCase User-Agent "^CherryPicker" bad_bot
SetEnvIfNoCase User-Agent "^NICErsPRO" bad_bot
SetEnvIfNoCase User-Agent "^Teleport" bad_bot
SetEnvIfNoCase User-Agent "^EmailCollector" bad_bot
SetEnvIfNoCase User-Agent "^LinkWalker" bad_bot
SetEnvIfNoCase User-Agent "^Zeus" bad_bot
Reply With Quote
  #5  
Old 12-26-2005, 07:06 AM
Stef's Avatar
Stef Stef is offline
Royal Croc
 
Join Date: May 2004
Posts: 715
Default Re: custom error pages

Just in case you need some examples on 404 pages, check this out

Stef.
Reply With Quote
  #6  
Old 12-26-2005, 09:02 AM
TeeJa's Avatar
TeeJa TeeJa is offline
Royal Croc
 
Join Date: Dec 2004
Location: Kerrville, Texas
Posts: 688
Default Re: custom error pages

Quote:
Originally Posted by Stef
Just in case you need some examples on 404 pages, check this out

Stef.
Stef, OMG, you check out some of those pages..
Reply With Quote
  #7  
Old 12-26-2005, 09:16 AM
MachineDog MachineDog is offline
Royal Croc
 
Join Date: Jul 2005
Location: Somewhere in the everglades.
Posts: 513
Default Re: custom error pages

Haha, that DOS 404 page is awesome.
__________________

Reply With Quote
  #8  
Old 12-26-2005, 11:27 AM
sandykc sandykc is offline
Hatchling Croc
 
Join Date: Dec 2005
Posts: 9
Red face Re: custom error pages

:-/ Well, I now have a .htaccess file and my 404.html files defined. I copied the content for the .htaccess and it didn't work, so I deleted the "RewriteEngine On" line and tried again.. and it still didn't work. It tells me the file wasn't found and:

"Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

I have put the .htaccess in my public_html folder and in my root folder along with the 404.html file in both locations. (Initially only had it in the public_html folder because I thought that's where it'd go, but added it to the main root thinking maybe that was at issue).

Is this perhaps something that will only work after my dns has propogated? I REALLY wanted to see it work beforehand so I can appropriately direct my visitors if I've messed up something in the move.

Thanks for any additional insights or suggestions you may have.
Reply With Quote
  #9  
Old 12-26-2005, 12:14 PM
quietFinn's Avatar
quietFinn quietFinn is offline
Emperor Croc
 
Join Date: Feb 2005
Posts: 2,731
Default Re: custom error pages

I went to cPanel->Error pages and clicked "404", added some text in the text area and saved it as "404.shtml".
Tfe file "404.shtml" appears to be in public_html directory and there's nothing in .htaccess, and it works as expected.

Quote:
Originally Posted by sandykc

Is this perhaps something that will only work after my dns has propogated? I REALLY wanted to see it work beforehand so I can appropriately direct my visitors if I've messed up something in the move.
Then I tried what I get if I enter my site using the IP+username, i.e.
http://IP/~username/nonexistingfile.htm here and it did NOT work.
Reply With Quote
  #10  
Old 12-27-2005, 09:05 AM
sandykc sandykc is offline
Hatchling Croc
 
Join Date: Dec 2005
Posts: 9
Default Re: custom error pages

Thanks quietFinn,

Hi went ahead and bit the bullet and changed my dns settings. Now that the domain name is actually pulling off the site, the 404 works just fine. It's interesting that it wouldn't work with the temporary URL though.

So, looks like I'm switched over and working well.
SandyKC
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 02:22 AM.

 
Forum SEO by Zoints