{"id":77,"date":"2009-04-08T08:11:00","date_gmt":"2009-04-08T08:11:00","guid":{"rendered":"http:\/\/digitalsrc.com\/blog\/how-to-create-custom-404-error-page\/"},"modified":"2013-04-21T12:31:25","modified_gmt":"2013-04-21T12:31:25","slug":"how-to-create-custom-404-error-page","status":"publish","type":"post","link":"https:\/\/digitalsrc.com\/blog\/how-to-create-custom-404-error-page\/","title":{"rendered":"How to Create Custom 404 Error Page"},"content":{"rendered":"<p>In my last article I discussed about the various reasons for which a website can throw a 404 error. While they are largely avoidable, with a little effort we can actually get the 404 errors to work for our website rather than working against it.<\/p>\n<p>The solution is simple, create a custom 404 page. Instead of the ugly &#8220;404 Error &#8211; Page not Found&#8221; we can have a nice page that tells the visitors that something has gone wrong and provide him with alternatives. This would help retain the visitors to your website to great extent.<\/p>\n<p>Now the question is, how to create a custom 404 page ?<\/p>\n<p><span>Creating Custom 404 Page in Apache<\/span><\/p>\n<p>a) Download your .htaccess file from server using FTP.<br \/>\nb) Open using Notepad and look for the line below..<br \/>\nErrorDocument 404 \/path\/to\/your\/error\/file.html<br \/>\nc) Download this error file mentioned in the path and modify the HTML to customize it, alternatively, create a separate custom 404 page and replace the &#8220;\/path\/to\/your\/error\/file.html&#8221; with the path to the new file.<br \/>\n<!--more-->d) Save the .htaccess file and upload to your server.<br \/>\ne) Type in a wrong URL that you know doesn&#8217;t exist and check if the custom 404 page shows up.<\/p>\n<p><span>Points to Note:<\/span><br \/>\na) Make sure you keep a back up of your .htaccess file before uploading the new file. This is a very crucial file for websites on Apache and can create a mess if you write anything silly in it.<\/p>\n<p>b) In case you don&#8217;t have a .htaccess file on your server, you can create a new one in a notepad. Just add the line below and it should work well.<br \/>\nErrorDocument 404 \/path\/to\/your\/error\/custom404page.html<\/p>\n<p>c) Though most web hosting companies that offers Apache server gives access to .htaccess file, some of them still don&#8217;t. In case you are on one of those servers speak to your host.<\/p>\n<p><span>How to Create Custom 404 Error Page in IIS<\/span><\/p>\n<p>This is again a very simple process but you will need to have access to your server to do this.<\/p>\n<p>a) Open Your Internet Service Managerand right click on the website for which you want to set the custom 404 error page.<br \/>\nb) Click on Properties<br \/>\nc) CLick on Custom Errors tab.<br \/>\nd) You will see a long list of errors, scroll down till you see 404 HTTP error on the left column.<br \/>\ne) On the right column (Content) you will see a file associated with it.<br \/>\nf) You can edit this file and customize it. Alternatively, choose Edit Properties and change the file to the custom 404 file that you have already created.<br \/>\ng) Check if the custom 404 error page is working by typing a wrong URL.<\/p>\n<p>So don&#8217;t let those visitors bounce off , create a nice and attractive custom 404 error page and keep them in.<\/p>\n<p><span>Related Post: <a href=\"http:\/\/digitalsrc.com\/blog\/causes-for-404-error-code-and-solutions\/\">Various Causes of 404 Error Code and Solutions<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my last article I discussed about the various reasons for which a website can throw a 404 error. While they are largely avoidable, with a little effort we can actually get the 404 errors to work for our website rather than working against it. The solution is simple, create a custom 404 page. Instead [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,339,93],"tags":[185,189,186,188,187],"_links":{"self":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/posts\/77"}],"collection":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":0,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"wp:attachment":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}