{"id":2180,"date":"2011-06-27T08:58:16","date_gmt":"2011-06-27T15:58:16","guid":{"rendered":"http:\/\/queenofsubtle.com\/404\/?page_id=2180"},"modified":"2011-06-27T08:58:23","modified_gmt":"2011-06-27T15:58:23","slug":"build-your-own-404","status":"publish","type":"page","link":"https:\/\/queenofsubtle.com\/404\/?page_id=2180","title":{"rendered":"Build your own 404"},"content":{"rendered":"<p><a name=\"apache\"><\/a><strong>Apache<\/strong><\/p>\n<p>Create a file called .htaccess in the root directory of the server (the one you refer to as &#8216;\/&#8217;) and enter your error handlers in the following format, one per line:<\/p>\n<p><pre style=\"padding-left: 30px;\">ErrorDocument [3-digit code] [action]<\/pre>\n<\/p>\n<p>For example, you can point to a custom 404 page like this:<\/p>\n<p><pre style=\"padding-left: 30px;\">ErrorDocument 404 \/errors\/custom404.html<\/pre>\n<\/p>\n<p>You can also simply have it display some other text:<\/p>\n<p><pre style=\"padding-left: 30px;\">ErrorDocument 404 \"Sorry, this page doesn't exist.<\/pre>\n<\/p>\n<p>Make sure you begin the text with a quote (&#8220;).<\/p>\n<p>Windows users have reported problems creating .htaccess files. One option is to create a file named &#8216;htaccess.txt&#8217;, FTP it to your web host, and then rename it to .htaccess.<\/p>\n<hr \/>\n<p><a name=\"iis\"><\/a><strong>Microsoft IIS<\/strong><\/p>\n<p>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.<\/p>\n<p>If you&#8217;re using an ISP running IIS, you&#8217;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.<\/p>\n<hr \/>\n<p><a name=\"nginx\"><\/a><strong>nginx<\/strong><\/p>\n<p>In nginx.conf, you can configure a 404 page for the entire server, or for specific locations.<\/p>\n<p>For the entire site, add this to the server block:<\/p>\n<p><pre style=\"padding-left: 30px;\">server {\r\n    listen 80;\r\n    error_page  404  \/website_page_not_found.html;\r\n    ...\r\n    }<\/pre>\n<\/p>\n<p>For a specific directory, add the following:<\/p>\n<p><pre style=\"padding-left: 30px;\">location \/this_directory {\r\n       error_page 404 = \/404_not_found.html;\r\n    }<\/pre>\n<\/p>\n<hr \/>\n\r\n\t\t\t<div style=\"clear: both; float: none;\" class=\"ratepost-clear\"><\/div>\r\n\t\t\t<div id=\"ratepost-2180\" class=\"ratepost\" rel=\"3\">\r\n\t\t\t\t<div class=\"rating-info\">rating: 3.00\/5<\/div>\r\n\t\t\t\t\t<span class=\"rating3\"><div class=\"star1\" rel=\"1\"><\/div><div class=\"star2\" rel=\"2\"><\/div><div class=\"star3\" rel=\"3\"><\/div><div class=\"star4\" rel=\"4\"><\/div><div class=\"star5\" rel=\"5\"><\/div><\/span>\r\n\t\t\t\t<div class=\"status-info\"><\/div>\r\n\t\t<\/div><div style=\"clear: both; float: none;\" class=\"ratepost-clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Apache Create a file called .htaccess in the root directory of the server (the one you refer to as &#8216;\/&#8217;) and enter your error handlers in the following format, one [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2128,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"_links":{"self":[{"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/pages\/2180"}],"collection":[{"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2180"}],"version-history":[{"count":10,"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/pages\/2180\/revisions"}],"predecessor-version":[{"id":2190,"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/pages\/2180\/revisions\/2190"}],"up":[{"embeddable":true,"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=\/wp\/v2\/pages\/2128"}],"wp:attachment":[{"href":"https:\/\/queenofsubtle.com\/404\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}