{"id":155,"date":"2010-04-16T11:21:41","date_gmt":"2010-04-16T10:21:41","guid":{"rendered":"http:\/\/blog.rabihtawil.com\/?p=155"},"modified":"2010-04-16T11:21:41","modified_gmt":"2010-04-16T10:21:41","slug":"custom-error-pages-using-htaccess","status":"publish","type":"post","link":"http:\/\/www.raytawil.com\/?p=155","title":{"rendered":"Custom error pages using .htaccess"},"content":{"rendered":"<p>We&#8217;ve all seen the dreaded Error 404 message &#8211; the result of broken  links and mistyped URLs. You&#8217;ve probably been on some websites where the  error pages are customised with their own logo and message, and I&#8217;m  sure you&#8217;ll agree that it looks far more professional than the standard  one.<\/p>\n<p>In this article we&#8217;ll show you how to use Apache&#8217;s .htaccess  file to make your own customised error 404 pages.<\/p>\n<p>Create a new text file on your computer, and call it &#8220;htaccess.txt&#8221;.  Enter the following lines:<\/p>\n<pre><code><span style=\"color: #0000ff;\">&lt;Files .htaccess&gt;\n\norder allow,deny\n\ndeny from all\n\n&lt;\/Files&gt;<\/span>\n\n<\/code><\/pre>\n<p>Now you need to create the 404 page. Make a new web page called  &#8220;error404.htm&#8221; and enter &#8220;This is my 404 page&#8221;. Enter it a few dozen  times, as Internet Explorer won&#8217;t display it unless the file is over 512  bytes.<\/p>\n<p>Once it&#8217;s done, login to your webspace with your FTP client,  and create a new folder called &#8220;errordocs&#8221;. Upload the file  &#8220;error404.htm&#8221; to this directory. Upload &#8220;htaccess.txt&#8221; to the root of  your webspace and rename it to &#8220;.htaccess&#8221; \u2014 there&#8217;s no .txt at the end,  no name in front, just &#8220;.htaccess&#8221;. If the file seems to vanish don&#8217;t  worry, some FTP clients don&#8217;t display it \u2014 the file&#8217;s still there.<\/p>\n<pre>\n<code>\n\nErrorDocument 404 \/errordocs\/error404.htm<\/code><\/pre>\n<p>The first part stops people viewing your .htaccess file. The  second part tells Apache to redirect any 404 errors to the file  &#8220;error404.htm&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve all seen the dreaded Error 404 message &#8211; the result of broken links and mistyped URLs. You&#8217;ve probably been on some websites where the error pages are customised with their own logo and message, and I&#8217;m sure you&#8217;ll agree that it looks far more professional than the standard one. In this article we&#8217;ll show [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[124],"tags":[],"_links":{"self":[{"href":"http:\/\/www.raytawil.com\/index.php?rest_route=\/wp\/v2\/posts\/155"}],"collection":[{"href":"http:\/\/www.raytawil.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.raytawil.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.raytawil.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.raytawil.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=155"}],"version-history":[{"count":0,"href":"http:\/\/www.raytawil.com\/index.php?rest_route=\/wp\/v2\/posts\/155\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.raytawil.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.raytawil.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.raytawil.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}