Build your own 404



Create a file called .htaccess in the root directory of the server (the one you refer to as ‘/’) and enter your error handlers in the following format, one per line:

ErrorDocument [3-digit code] [action]

For example, you can point to a custom 404 page like this:

ErrorDocument 404 /errors/custom404.html

You can also simply have it display some other text:

ErrorDocument 404 "Sorry, this page doesn't exist.

Make sure you begin the text with a quote (“).

Windows users have reported problems creating .htaccess files. One option is to create a file named ‘htaccess.txt’, FTP it to your web host, and then rename it to .htaccess.

Microsoft IIS

Customizing 404 errors in IIS is easy if you have access to the server. Go into Properties for the WWW service. Go to the Custom Errors tab. Find the listing for 404 and replace the default document with your own creation.

If you’re using an ISP running IIS, you’ll have to ask them to change this information for you. Just send them the URL of your 404 page, and ask them to set it as your custom 404 handler.


In nginx.conf, you can configure a 404 page for the entire server, or for specific locations.

For the entire site, add this to the server block:

server {
    listen 80;
    error_page  404  /website_page_not_found.html;

For a specific directory, add the following:

location /this_directory {
       error_page 404 = /404_not_found.html;