The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating 404 Error

Discussion in 'General Discussion' started by stefanmain, May 16, 2010.

  1. stefanmain

    stefanmain Active Member

    Joined:
    May 12, 2010
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    As suggested by cPanel (to which I have recently moved after many years at PlusMail, and I really like it!), I have created my own "404 File Not Found" page. It is missing.html. I have uploaded it to the /publc_html/ directory, and it opens fine when I go to it directly in a browser. Now I am trying to figure out how to inform cPanel of missing.html. I found cPanel's "Error Pages" utility, and am now at the page labeled "Editing 404.shtml (Not found)". What do I do next? At Line 1, do I simply type "missing.html"? With quotation marks? With comment tags? Thank you for your help.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Your system is setup to redirect to 404.shtml (and other error pages as needed) automagically, not missing.html
    You might redirect to your own file if you like, but an .html file wouldn't be as useful as the .shtml file would be. (for variables you might like to use)

    Suggestion, edit your 404.shtml (and the others in your error pages section) any way you like. Backup the default pages of course in advance of editing for safe keeping.

    If you look closely at the default 404.shtml you'll find this line in there (for example)
    Code:
    <!--#echo var="REMOTE_ADDR" -->
    If you placed that line in your missing.html it wouldn't do anything for you. If you renamed your file missing.shtml it would display information to you in your browser.

    These are useful for error pages. You'll notice on your error pages editor that there's several buttons across the top for Referring URL, Visitor's IP Address, Requested URL and so on.

    Click somewhere in your page where you'd like to add one of those variables and then click the button to auto add one for you. Now save the edits and try visiting this URL:

    yourdomain.com/infoprowashere.html

    That URL should redirect to your 404.shtml page, but, in your address bar you will be here: yourdomain.com/infoprowashere.html
    And of course there is where you'll see your page with the varibable you added.

    GL!
     
  3. stefanmain

    stefanmain Active Member

    Joined:
    May 12, 2010
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Thanks. I will do as you suggest, back up the existing 404.shtml, and rename missing.html to 404.shtml. But first, two questions: (1) Where is the existing file 404.shtml? I don't see it in File Manager. And (2) about converting my file missing.html to 404.shtml, do I simply rename it in /public_html? From what I understand of your post, I don't think so. Or can I simply paste the text from the existing missing.html file (the html coding) into the blank white space at cPanel's page "Editing 404.shtml (Not found)"? If so, is it all the coding from html to /html, or just the text between the body and /body tags?
     
    #3 stefanmain, May 16, 2010
    Last edited: May 16, 2010
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    If you have no file called 404.shtml in the root of your account /home/username/public_html/ yes, you can create one by opening the error pages for editing and simply click save. The cpanel system will create one for you. Or add your own here to the editor and save. After, you'll find it in the proper place.

    As mentioned you might do better to click the 404.shtml(not found) to view, and then click save. Now you have a default file to edit as you see fit located in your public_html (or click edit here again to edit the new file your system created for you). How you edit that file is up to you, but the default file should be referenced for proper HTML of course.
     
  5. stefanmain

    stefanmain Active Member

    Joined:
    May 12, 2010
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    I have successfully created the 404.shtml file on one of my websites, but on a second, it is not working. Both use cPanel.

    The text I pasted into the 404.shtml file on both domains is similar. Here is the complete text/code I inserted into the white space at cPanel>>Advanced>>Error Pages>>404 (not found )

    After pasting the text, I clicked on Save.

    Again, on one of the domains, it works. On the other, it doesn't (the "regular" error message opens).

    What am I doing wrong?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="robots" content="noindex">
    <meta http-equiv="Refresh" content="10; url=http://www.mydomain.org/index.html">
    <title>Wind Power</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link href="http://www.mydomain.org/scripts/script.css" rel="stylesheet" type="text/css">
    <link rel="SHORTCUT ICON" href="http://www.mydomain.org/favicon.ico">
    <title>Oops!</title>
    </head>
    
    <body>
    
    
    <p align="center"><img src="../pix/oops.gif" alt="Oops" width="186" height="102"></p>
    <p align="center" class="text">We can't find the page you are looking for.<br>
    It may be that we are working on it, or that we have replaced it with a newer
    version.<br>
    Or, it’s possible that you misspelled something in the address.
    <p align="center" class="text">In just a moment, you will be jumped to our home page.<br>
    If that does not work, please <a
    href="http://www.mydomain.org" target="_top">click here</a>.</p>
    <p align="center" class="text"><a href="http://www.mydomain.org" target="_top"><img src="../pix/logo5.gif" alt="!" width="305" height="92" border="0"></a></p>
    </body>
    
    </html>
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    On the one not working, does the file exist in public_html 404.shtml?
     
  7. stefanmain

    stefanmain Active Member

    Joined:
    May 12, 2010
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    I found the problem. It's me.

    This afternoon, I tried Google Chrome and Opera, and the 404 error page worked fine. So, the error is with IE8. I have IE7 Pro installed with IE8. So, I clicked on Tools>>IE7Pro Preferences>>IE Settings>> and unselected "Suggestions on browser navigation error".

    And it worked.

    I apologize for not having done that first. Thank you for your help.
     
    #7 stefanmain, Jul 20, 2010
    Last edited: Jul 20, 2010
Loading...

Share This Page