{"id":245,"date":"2016-05-02T11:14:00","date_gmt":"2016-05-02T11:14:00","guid":{"rendered":"http:\/\/www.copahost.com\/blog\/?p=245"},"modified":"2020-05-31T13:30:38","modified_gmt":"2020-05-31T13:30:38","slug":"create-custom-404-error-page-htaccess","status":"publish","type":"post","link":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/","title":{"rendered":"Custom 404 page: Create error pages using htaccess"},"content":{"rendered":"<p>Creating a Custom 404 page is very important for SEO nowadays. First of all, for SEO purposes. Google increases the reputation of domains with their 404 error page correctly configured. The <a href=\"https:\/\/www.copahost.com\/blog\/404-error-code\/\">404 error code<\/a> means that one specific file on the server was not found. For example, you can use images, <a href=\"https:\/\/www.copahost.com\/blog\/font-color-html\/\">HTML font colors<\/a>, and CSS styles in your error pages. This is a part of the HTTP protocol structure defined in <a href=\"https:\/\/tools.ietf.org\/html\/rfc7231\" target=\"_blank\" rel=\"noopener noreferrer\">RFC7231.<\/a><\/p>\n<p>The advantages of having a properly configured not found error page:<\/p>\n<ul>\n<li>It helps your visitors to guide for the correct place in your site<\/li>\n<li>Google will increase your search engine rankings<\/li>\n<li>It&#8217;s charming and modern<\/li>\n<\/ul>\n<p>How the default raw 404 Not found error (without customization) looks like:<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-248 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg\" alt=\"raw error message for 404 not found error\" width=\"721\" height=\"335\" \/><\/p>\n<p>To have a custom 404 page for this error, we should edit our .htacess file, which is located under the root folder (usually inside the public_html folder for cPanel servers).<\/p>\n<p>If you can&#8217;t find the .htacess file, you can simply create it.<\/p>\n<h3>Setting a custom 404 error message inside .htaccess<\/h3>\n<p>To set a custom html message, you should insert this line into <strong>.htaccess<\/strong>:<\/p>\n<pre class=\"lang:default decode:true \">ErrorDocument 404 \"&lt;H1&gt;Error 404&lt;\/H1&gt; My Custom Error 404 message goes here\"<\/pre>\n<p>Now your error page will look like this:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-246 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess-2.jpg\" alt=\"404 error page\" width=\"677\" height=\"325\" \/><\/p>\n<h3>Setting the File Not found error to redirect to a specific error 404 custom page<\/h3>\n<p>You can create a specific custom 404 page to handle this error. In this example, we will create a file called<strong> 404.html<\/strong> , and place it in our root folder (usually public_html).<\/p>\n<p>Now we should add this line to out <strong>.htaccess<\/strong> file:<\/p>\n<pre class=\"lang:default decode:true\">ErrorDocument 404 \/404.html<\/pre>\n<p>Now when opening a non-existent URL\u00a0in the browser, you can see the contents of the just configured<strong>\u00a0404.html<\/strong> page:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-247\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess-3.jpg\" alt=\"custom 404 page working by htaccess \" width=\"700\" height=\"384\" \/><\/p>\n<h3>Common\u00a0error pages can also be customized, such as 500, 401, 403<\/h3>\n<p><strong>401 &#8211; Unauthorized &#8211;<\/strong> When your visitor tries to access a <a href=\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\">password-protected folder<\/a>, without a valid login.<\/p>\n<p><strong>403 &#8211; Forbidden<\/strong> &#8211; When your visitor tries to access a URL\u00a0without a valid file or folder permissions.<\/p>\n<p><strong>500 &#8211; Internal Server Error<\/strong> &#8211;\u00a0Appears when having\u00a0problems with cgi-bin scripts or permission issues.<\/p>\n<p>To configure them, you should add these lines to your .htacess file:<\/p>\n<pre class=\"lang:default decode:true\">ErrorDocument 500 \/500.html\r\nErrorDocument 401 \/401.html\r\nErrorDocument 403 \/403.html\r\n<\/pre>\n<p>This guide applies either for <a href=\"https:\/\/www.copahost.com\/en\/web-hosting\">cPanel cheap web hosting servers<\/a>\u00a0and for <a href=\"https:\/\/www.copahost.com\/en\/dedicated-servers\">dedicated servers running apache<\/a> or a similar web server.<\/p>\n<h3>Conclusion<\/h3>\n<p>Customizing the error pages is a very important task nowadays, as Google\u00a0considers this important for your <a href=\"https:\/\/www.copahost.com\/blog\/google-website-hosting\/\" >website<\/a> structure and SEO. You can configure an <a href=\"https:\/\/www.copahost.com\/blog\/how-to-fix-500-internal-server-error\/\">error 500<\/a> or a 404 custom page in every kind of site through the .htaccess file. Also, there are alternatives to configure a custom 404 page. For instance, by cPanel. You can have images, custom <a href=\"https:\/\/www.copahost.com\/blog\/font-color-html\/\">HTML font colors<\/a> as well as custom <a href=\"https:\/\/www.copahost.com\/blog\/html-background-color\/\">HTML background colors<\/a> in such pages.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a Custom 404 page is very important for SEO nowadays. First of all, for SEO purposes. Google increases the reputation of domains with their 404 error page correctly configured. The 404 error code means that one specific file on the server was not found. For example, you can use images, HTML font colors, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[77,78,75,79,76,80,64],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-seo","tag-77","tag-78","tag-75","tag-404-not-found","tag-76","tag-error-page","tag-htaccess"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom 404 page: Create error pages using htaccess - Copahost<\/title>\n<meta name=\"description\" content=\"How to create a customized 404 Not Found error page in your website using .htacess . Also explains how to set similar errors like 500 and 401\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom 404 page: Create error pages using htaccess - Copahost\" \/>\n<meta property=\"og:description\" content=\"How to create a customized 404 Not Found error page in your website using .htacess . Also explains how to set similar errors like 500 and 401\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\" \/>\n<meta property=\"og:site_name\" content=\"Copahost\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-02T11:14:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-31T13:30:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg\" \/>\n<meta name=\"author\" content=\"Gustavo Gallas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gustavo Gallas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\"},\"author\":{\"name\":\"Gustavo Gallas\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\"},\"headline\":\"Custom 404 page: Create error pages using htaccess\",\"datePublished\":\"2016-05-02T11:14:00+00:00\",\"dateModified\":\"2020-05-31T13:30:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\"},\"wordCount\":432,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg\",\"keywords\":[\"401\",\"403\",\"404\",\"404 not found\",\"500\",\"error page\",\"htaccess\"],\"articleSection\":[\"SEO\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\",\"name\":\"Custom 404 page: Create error pages using htaccess - Copahost\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg\",\"datePublished\":\"2016-05-02T11:14:00+00:00\",\"dateModified\":\"2020-05-31T13:30:38+00:00\",\"description\":\"How to create a customized 404 Not Found error page in your website using .htacess . Also explains how to set similar errors like 500 and 401\",\"breadcrumb\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg\",\"width\":721,\"height\":335},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.copahost.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom 404 page: Create error pages using htaccess\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"name\":\"Copahost\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.copahost.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\",\"name\":\"Copahost\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"width\":223,\"height\":40,\"caption\":\"Copahost\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\",\"name\":\"Gustavo Gallas\",\"description\":\"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/\"],\"url\":\"https:\/\/www.copahost.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom 404 page: Create error pages using htaccess - Copahost","description":"How to create a customized 404 Not Found error page in your website using .htacess . Also explains how to set similar errors like 500 and 401","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/","og_locale":"en_US","og_type":"article","og_title":"Custom 404 page: Create error pages using htaccess - Copahost","og_description":"How to create a customized 404 Not Found error page in your website using .htacess . Also explains how to set similar errors like 500 and 401","og_url":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/","og_site_name":"Copahost","article_published_time":"2016-05-02T11:14:00+00:00","article_modified_time":"2020-05-31T13:30:38+00:00","og_image":[{"url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg"}],"author":"Gustavo Gallas","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Gustavo Gallas","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#article","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/"},"author":{"name":"Gustavo Gallas","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246"},"headline":"Custom 404 page: Create error pages using htaccess","datePublished":"2016-05-02T11:14:00+00:00","dateModified":"2020-05-31T13:30:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/"},"wordCount":432,"commentCount":0,"publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg","keywords":["401","403","404","404 not found","500","error page","htaccess"],"articleSection":["SEO"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/","url":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/","name":"Custom 404 page: Create error pages using htaccess - Copahost","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg","datePublished":"2016-05-02T11:14:00+00:00","dateModified":"2020-05-31T13:30:38+00:00","description":"How to create a customized 404 Not Found error page in your website using .htacess . Also explains how to set similar errors like 500 and 401","breadcrumb":{"@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#primaryimage","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/404-page-by-htaccess.jpg","width":721,"height":335},{"@type":"BreadcrumbList","@id":"https:\/\/www.copahost.com\/blog\/create-custom-404-error-page-htaccess\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.copahost.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Custom 404 page: Create error pages using htaccess"}]},{"@type":"WebSite","@id":"https:\/\/www.copahost.com\/blog\/#website","url":"https:\/\/www.copahost.com\/blog\/","name":"Copahost","description":"","publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.copahost.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.copahost.com\/blog\/#organization","name":"Copahost","url":"https:\/\/www.copahost.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","width":223,"height":40,"caption":"Copahost"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246","name":"Gustavo Gallas","description":"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.","sameAs":["https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/"],"url":"https:\/\/www.copahost.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/comments?post=245"}],"version-history":[{"count":13,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":2384,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/245\/revisions\/2384"}],"wp:attachment":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media?parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/categories?post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/tags?post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}