{"id":34911,"date":"2015-03-18T10:30:33","date_gmt":"2015-03-18T17:30:33","guid":{"rendered":"http:\/\/www.bruceclay.com\/blog\/?p=34911"},"modified":"2023-01-31T13:02:05","modified_gmt":"2023-01-31T21:02:05","slug":"how-to-configure-a-404-error-page-apache","status":"publish","type":"post","link":"https:\/\/www.bruceclay.com\/blog\/how-to-configure-a-404-error-page-apache\/","title":{"rendered":"How to Configure a Custom 404 Error Page \u2014 Apache Server Edition"},"content":{"rendered":"

A 404 File Not Found page \u2014 also known as a 404 error page \u2014\u00a0is a web page that lets a user know when the page they are trying to access cannot be located.\u00a0A custom<\/em> 404 error page is a 404 error page that is crafted thoughtfully with user experience in mind. Custom 404 error pages are put into place to fend off confusion, explain the situation, and offer thoughtful next steps that keep the ball rolling.<\/p>\n

To get a custom 404 error page up and running on your website, you\u2019ll need to do some communicating with your server.<\/p>\n

\"404-error_PaulYokota\"<\/a>
An example of a custom 404 error page.<\/figcaption><\/figure>\n

How you go about getting a custom 404 error page setup on your server will vary greatly depending on your server type. This article addresses how to set up a custom 404 error page on an Apache server. \u00a0<\/strong><\/p>\n

Getting a custom 404 error page up and running on the Apache Server is a five-part process:<\/p>\n

    \n
  1. Design an on-brand custom 404 error page<\/a>.<\/li>\n
  2. Publish your custom 404 error page.<\/li>\n
  3. Determine what type of server you are using, or if you are using a CMS like WordPress.<\/li>\n
  4. Use your public_html folder and .htaccess file to tell your server to deliver the 404 error page anytime a request is made for a web page that doesn\u2019t exist.<\/li>\n
  5. Test it! Make sure your 404 error page is live and working as expected.<\/li>\n<\/ol>\n

    In this post we cover parts 3,\u00a04 and 5\u00a0of this process; you should already have parts 1\u00a0and 2\u00a0done. If you haven\u2019t designed your custom 404 error page yet, read How to Design a 404 Error Page That Saves a Sale<\/a>\u00a0for strategic inspiration.<\/p>\n

    How to Determine Your Server Type<\/h2>\n

    Your website is hosted on a server<\/em><\/a> that dishes out web pages when people navigate to URLs within your domain. There are several types of servers.<\/p>\n

    \"server-illustration-Apache_2\"<\/a>First, the easiest one: If you are using WordPress,\u00a0then you know you\u2019re using WordPress and you should read about WordPress 404 error page setup<\/a>; this Apache server article will not help you. Similarly, if you happen to be using Microsoft IIS, then you should read our How to Configure a Custom 404 Error Page in Microsoft IIS Server<\/a> post.<\/p>\n

    If you aren\u2019t using WordPress and you don\u2019t know what kind of server you are using, call your server provider (the people you pay to host your website every month \u2013 like BlueHost<\/a>, for instance), and ask them. While you have them on the line, make sure to also ask them if it is possible to set up a custom 404 error page; most server providers allow you to do this, but not all.<\/p>\n

    If your server provider tells you your website is hosted on the most widely used Web server \u2014\u00a0the Apache server \u2014\u00a0then read on!<\/strong><\/p>\n

    Proceed with Caution!<\/h2>\n

    If you are reading this blog post, I am assuming that you don\u2019t have the luxury of asking an IT department to set your custom 404 error page up for you. If you do<\/em> have an IT\/systems department to refer to, by all means, ask for help! IT folks love servers and lines of code that talk to servers, and they effectively know how to handle both.<\/p>\n

    If you\u2019re going in on your own, it\u2019s smart to make sure you have your entire website backed up before you make any changes to code at the server level. The amendments we\u2019ll be making to add a custom 404 error page are minimal, but it\u2019s always better to be safe than sorry when it comes to tinkering with server-side code.<\/p>\n

    How to Tell Your Server to Deliver the 404 Error Page<\/h2>\n

    This blog post is written to help folks using the Apache server add a custom 404 error page to their website. Like most processes, there\u2019s inherently \"server-illustration-3\"<\/a>more than one way to do this. The following five-step process is the most universal method<\/strong>, as it only requires FTP access to your server and a text editor, like Notepad++<\/a>\u00a0(on a PC) or TextEdit (on a Mac). (It’s worth mentioning here that Notepad [the\u00a0default text editor in Windows] and Notepad++ are not the same thing. If you’re using a PC, we recommend downloading the free Notepad++ text\u00a0editor<\/a>;\u00a0using\u00a0the standard release version of Notepad may cause errors if the server is running Linux.)<\/p>\n

    Step 1: Locate or create your .htaccess file<\/h3>\n

    After identifying that you are using the Apache server, the first step is to locate your .htaccess file.<\/p>\n

    A .htaccess file is a file that communicates how and when your server should deliver specific information to your end user. In this case, specifically, when your server should deliver a fancy, custom-made 404 error page. Your .htaccess file should already be in the root directory of your website.<\/p>\n

    To access your .htaccess file:<\/p>\n