preload preload preload preload

404 Error – File Not Found

The 404 or Not Found error message is an HTTP standard response code indicating that the client was able to communicate with the server but either the server could not find what was requested, or it was configured not to fulfill the request and not reveal the reason why. 404 errors should not be confused with “server not found” or similar errors, in which a connection to the destination server cannot be made at all.

If you request a non existent page on a server .It will not show up your normal Apache custom 404 page.

A trick to show a custom page ( eg: cferror.cfm ) when a non existant cfm page is accessed. This can be done with the .htaccess file. .htaccess is a regular text file that contains “scripts” that allow you to override certain things on your server – like creating a custom 404 error document that replaces the server’s default 404 document.

Method 1

To be able to create your own 404 error document, first you need to create the actual document (use your HTML editor of choice or hand code it if you like), upload the document to the root directory on your server, and finally include the following in your document root .htaccess file:

ErrorDocument 404 http://www.yourdomain.com/404.html

     Method 2

    Add the following entry to the .htaccess file in your DocumentRoot

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) /cferror.cfm?%{REQUEST_URI}

    All request to the non existent pages are passed to cferror.cfm page with the requested URL as argument.

    • Share/Bookmark
    • Leave a Reply

      * Required
      ** Your Email is never shared