How to create a custom 404 error page?

Discussion in 'HTML & Website Design' started by HumayonSubzwari, Dec 9, 2014.

?

Would this make a good 404 error page?

  1. Yes, thumbs up!

    1 vote(s)
    100.0%
  2. No, not at all.

    0 vote(s)
    0.0%
  1. #1
    Im a beginner at all this. Want to create a custom 404 error page which would display this image and simply redirect the user to the homepage within 5 seconds of seeing the error.

    Can someone help me out with the coding and how I should go about it? Im gonna upload it through the cPanel. My server is linux


    Thanks a bunch![​IMG]
     
    Solved! View solution.
    HumayonSubzwari, Dec 9, 2014 IP
  2. #2
    Hosting companies provide this feature. You need to find the option in your hosting account. You can create an .htaccess file and put it in your main website directory. The .htaccess file should have the tag for 404 pages. See sample of .htaccess file given below. After the # Not found Error# tag you are telling the server the location of 404 page -


    # $Id: .htaccess,v 1.3 2003/06/12 10:53:20 hpdl Exp $
    #
    # This is used with Apache WebServers
    #
    # For this to work, you must include the parameter 'Options' to
    # the AllowOverride configuration
    #
    # Example:
    #
    # <Directory "/usr/local/apache/htdocs">
    # AllowOverride Options
    # </Directory>
    #
    # 'All' with also work. (This configuration is in the
    # apache/conf/httpd.conf file)

    # The following makes adjustments to the SSL protocol for Internet
    # Explorer browsers

    <IfModule mod_setenvif.c>
    <IfDefine SSL>
    SetEnvIf User-Agent ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    </IfDefine>
    </IfModule>

    # If Search Engine Friendly URLs do not work, try enabling the
    # following Apache configuration parameter
    #
    # AcceptPathInfo On

    # Fix certain PHP values
    # (commented out by default to prevent errors occuring on certain
    # servers)
    #
    #<IfModule mod_php4.c>
    # php_value session.use_trans_sid 0
    # php_value register_globals 1
    #</IfModule>

    # Ensure www on all URLs.
    RewriteCond %{HTTP_HOST} ^purplesale.com [NC]
    RewriteRule ^(.*)$ http://www.purplesale.com/$1 [L,R=301]

    # re-direct index.html to root / #
    RewriteCond %{THE_REQUEST} ^.*\/index\.html\ HTTP/
    RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

    # Not found Error#
    ErrorDocument 404 /resource-unavailable.html

    # Custom Error page#
    ErrorDocument 403 /custom-error.html
     
    Naina S, Dec 9, 2014 IP
  3. COBOLdinosaur

    COBOLdinosaur Active Member

    Messages:
    515
    Likes Received:
    123
    Best Answers:
    11
    Trophy Points:
    95
    #3
    Do not automatically re-direct to the home page or any other page. If there is a problem on the server that prevents serving of the home page you will put the browser in a re-direction loop until the browser detects it and notifies the user of a hard error. Put a link to the home page so the user initiates the action.

    Cd&
     
    COBOLdinosaur, Dec 10, 2014 IP
  4. masterdkv

    masterdkv Greenhorn

    Messages:
    5
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    23
    #4
    more easy if you used cpanel/whm
     
    masterdkv, Dec 10, 2014 IP
  5. rajika nanayakkara

    rajika nanayakkara Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    thanx i was looking for this.
     
    rajika nanayakkara, Dec 11, 2014 IP