{"id":3976,"date":"2021-05-04T18:50:00","date_gmt":"2021-05-04T22:50:00","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2016\/09\/16\/set-404-via-htaccess\/"},"modified":"2025-02-12T12:49:15","modified_gmt":"2025-02-12T17:49:15","slug":"set-custom-404-page","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/","title":{"rendered":"How to Set a Custom 404 Page Using .htaccess"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page-1024x538.png\" alt=\"How to Set a Custom 404 Page Using .htaccess\" class=\"wp-image-129320\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n\n<p>A <strong>404 error<\/strong> occurs when a requested page is not found on your website. Instead of displaying a generic error message, you can create a <strong><a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/creating-a-custom-404-error-page\/\">custom 404 page<\/a><\/strong> to improve user experience and reduce bounce rates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a 404 Error?<\/h2>\n\n\n\n<p>The <strong>404 error<\/strong> (HTTP status code \u201c404 Not Found\u201d) occurs when a server cannot locate the requested web page. This can happen due to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <strong>broken link<\/strong> or incorrect URL<\/li>\n\n\n\n<li>A <strong>deleted or moved page<\/strong><\/li>\n\n\n\n<li>A <strong>typo in the address bar<\/strong><\/li>\n<\/ul>\n\n\n\n<p>By default, web servers show a plain error page, which can frustrate users. Creating a <strong>custom 404 page<\/strong> helps retain visitors and guides them to useful content.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Set a Custom 404 Page in .htaccess<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><div class=\"yt-cquwXuXop5M\">\n\t<a class=\"play-video-cquwXuXop5M\" style=\"position: relative; display: flex; flex-wrap: wrap; align-items: center; cursor: pointer;\">\n\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.ytimg.com\/vi_webp\/cquwXuXop5M\/maxresdefault.webp\" width=\"1280\" height=\"720\" alt=\"How to Set a Custom 404 Page With  htaccess\" style=\"width: 100%; height: auto;\">\n\t\t<span class=\"fa fa-imh-play-circle imh-ds-icon play-circle\" style=\"position: absolute; display:block; font-size:150px; color: #c52228; opacity:0;\"><\/span>\n\t<\/a>\n<\/div><\/div>\n<\/div><figcaption class=\"wp-element-caption\">Don\u2019t have time to read the article? Watch our walk-through video.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create a Custom 404 Page<\/h3>\n\n\n\n<p>Before updating the <code>.htaccess<\/code>, you need a 404 error page (e.g., <code>404.html<\/code>). This page should: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Inform users that the page was not found.<\/li>\n\n\n\n<li>Provide helpful links to navigate back to important pages.<\/li>\n\n\n\n<li>Match your website\u2019s design<\/li>\n<\/ul>\n\n\n\n<p class=\"alert alert-info\">For detailed instructions on how to create a custom 404 page, see <a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/creating-a-custom-404-error-page\/\">Creating a Custom 404 Error Page<\/a>. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Edit the .htaccess File<\/h3>\n\n\n\n<ol class=\"wp-block-list article_list\">\n<li><a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/cpanel\/how-to-log-into-cpanel\/\">Login to your cPanel<\/a>. <div style=\"clear: both;\">\u00a0<\/div> <\/li>\n\n\n\n<li>Under the <strong>Files<\/strong> section click on <strong>File Manager<\/strong>. <br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"140\" class=\"wp-image-5597\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_create-404_01-click-file-manager.png\" alt=\"Set Custom 404 Page in .htaccess File Manager\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_create-404_01-click-file-manager.png 1042w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_create-404_01-click-file-manager-300x56.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_create-404_01-click-file-manager-768x144.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_create-404_01-click-file-manager-1024x192.png 1024w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure> <\/li>\n\n\n\n<li>Navigate to the document root folder for the site. <div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>Click on <strong>Settings<\/strong>. <br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"208\" class=\"wp-image-72397\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/2-click-settings.png\" alt=\"File Manager Settings\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/2-click-settings.png 1505w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/2-click-settings-300x83.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/2-click-settings-1024x284.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/2-click-settings-768x213.png 768w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure><div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>Ensure <strong>Show Hidden Files<\/strong> is selected. <br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"536\" class=\"wp-image-72406\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/3-click-show-hidden-files.png\" alt=\"Show Hidden Files\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/3-click-show-hidden-files.png 632w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/3-click-show-hidden-files-300x215.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure> <\/li>\n\n\n\n<li>Then click <strong>Save<\/strong>. <\/li>\n\n\n\n<li>Right-click on the <strong>.htaccess<\/strong> file and select <strong>Edit<\/strong>. <br><br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"408\" class=\"wp-image-72441\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/edit-htaccess.png\" alt=\"Edit the .htaccess file\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/edit-htaccess.png 636w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/edit-htaccess-300x163.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure><div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>If the <strong>.htaccess<\/strong> file didn\u2019t exist in the previous step, click on the <strong>+File<\/strong> link on the top left, name the file <strong>.htaccess<\/strong>, and set the directory for creation to <strong>\/public_html\/<\/strong> or the document root of your site. <br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"381\" class=\"wp-image-72442\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/create-htaccess-file.png\" alt=\"Creating an .htaccess file\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/create-htaccess-file.png 512w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/create-htaccess-file-300x152.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure><br><div style=\"clear: both;\"><div style=\"clear: both;\"><\/div><\/div><\/li>\n\n\n\n<li>You might have a text editor encoding dialog box pop-up, go ahead and just click <strong>Edit<\/strong>. <br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"516\" class=\"wp-image-72443\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/edit-file.png\" alt=\"Edit File Encoding Option\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/edit-file.png 507w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/edit-file-300x207.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure><\/li>\n\n\n\n<li>Now that you are ready to edit the <strong style=\"font-size: inherit;\">.htaccess<\/strong><span style=\"font-size: inherit;\"> file, the simplest way to set a 404 error page is by directly setting a 404 error message in the <\/span><strong style=\"font-size: inherit;\">.htaccess<\/strong><span style=\"font-size: inherit;\"> file itself:<\/span> <pre>ErrorDocument 404 \"&lt;H1&gt;Page not found&lt;\/H1&gt;\"<\/pre> <p style=\"width: 75%;\">If you already have a static HTML page that you\u2019d like to use for 404 errors you can also directly point to that file with the <strong>.htaccess<\/strong> file as well. In this example, we have a 404.html page we want to serve up. Be sure to replace \u201c404.html\u201d with your actual page name:<\/p> <pre>ErrorDocument 404 \/404.html<\/pre> <div style=\"clear: both;\">\u00a0<\/div> <\/li>\n\n\n\n<li>After you\u2019ve made your edits to the .htaccess file, click on <strong>Save Changes<\/strong>.<br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"76\" class=\"wp-image-72450\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/save-htaccess-file.png\" alt=\"Saving .htaccess file\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/save-htaccess-file.png 1160w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/save-htaccess-file-300x31.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/save-htaccess-file-1024x104.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/save-htaccess-file-768x78.png 768w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure> <br>You should see a green <strong>Success<\/strong> pop-up<figure><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"67\" class=\"size-full wp-image-5587\" style=\"width: 450px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_file-manager-text-editor-save-success.png\" alt=\"file-manager-text-editor-save-success\"><\/figure><div style=\"clear: both;\"><div style=\"clear: both;\"><\/div><\/div><\/li>\n\n\n\n<li>Now if you try to pull up a page that won\u2019t exist on the server such as <strong>\/ThisPageWon\u2019tExist\u00a0<\/strong>you should see the custom 404 error message that we\u2019ve configured. This first image below is the default 404 error page when a custom one is not set: <br><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"227\" class=\"wp-image-72412\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/website_website-troubleshooting_404s_404-default-error-in-browser-1.png\" alt=\"Custom 404 Page\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/website_website-troubleshooting_404s_404-default-error-in-browser-1.png 711w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/website_website-troubleshooting_404s_404-default-error-in-browser-1-300x91.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure><div style=\"clear: both;\"> <\/div><br>The second one is the custom 404 page that we just created:<div style=\"clear: both;\"><div style=\"clear: both;\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"256\" class=\"wp-image-5589\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/10\/website_website-troubleshooting_404s_404-custom-error-in-browser.png\" alt=\"404-custom-error-in-browser\"><\/figure><div style=\"clear: both;\"><br><br><div style=\"clear: both;\"><div style=\"clear: both;\"><\/div><\/div><\/div><\/div><\/div><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Redirect 404 to homepage using .htaccess<\/h2>\n\n\n\n<p>If you prefer to <strong>redirect users to your homepage<\/strong> instead of displaying an error page, add this line to your <code>.htaccess<\/code> file:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"ErrorDocument 404 \/\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ErrorDocument<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">404<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\/<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This simple line of code instructs the web server that whenever it encounters a 404 error (i.e., a missing page or resource), it should redirect the visitor to the homepage of your website. Let\u2019s break down how this works:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ErrorDocument<\/strong>: This is the directive that tells the server you\u2019re defining a custom error page.<\/li>\n\n\n\n<li><strong>404<\/strong>: Specifies the HTTP status code for which you\u2019re customizing the error page (in this case, a 404 error).<\/li>\n\n\n\n<li><strong>\/<\/strong>: The forward slash represents the homepage of your website. When a 404 error occurs, the server redirects the user to this URL.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>SEO Best Practices for Custom 404 Pages<\/strong><\/h2>\n\n\n\n<p>A well-designed 404 page can improve user experience and SEO. Here\u2019s how to optimize it:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Maintain Proper HTTP Status Codes<\/strong><\/h3>\n\n\n\n<p>Ensure your custom 404 page <strong>returns a 404 status code<\/strong>, not a <strong>200 (OK) status<\/strong>. Search engines need to recognize that the page is missing to avoid indexing errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Avoid Duplicate Content<\/strong><\/h3>\n\n\n\n<p>Make your 404 page <strong>unique<\/strong>. Avoid copying content from other pages to prevent duplicate content issues.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Provide Helpful Links<\/strong><\/h3>\n\n\n\n<p>Your 404 page should include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <strong>search bar<\/strong> for easy navigation<\/li>\n\n\n\n<li>Links to the <strong>homepage<\/strong>, <strong>popular articles<\/strong>, or a <strong>sitemap<\/strong><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Monitor 404 Errors in Google Search Console<\/strong><\/h3>\n\n\n\n<p>Regularly check <strong>Google Search Console<\/strong> for <strong>crawl errors<\/strong> and fix broken links. This helps maintain your site\u2019s <strong>SEO health<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thoughts<\/h2>\n\n\n\n<p>Now you know how to:<br>\u2714 Create a <strong>custom 404 page<\/strong><br>\u2714 Modify <code>.htaccess<\/code> to display your error page<br>\u2714 Redirect 404 errors to the homepage (if preferred)<br>\u2714 Follow <strong>SEO best practices<\/strong><\/p>\n\n\n\n<p>A well-handled 404 error improves user experience and keeps visitors engaged with your website. For more guidance, check out our tutorial on <strong><a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/creating-a-custom-404-error-page\/\">creating a custom 404 page<\/a><\/strong>.<\/p>\n\n\n\n<p>Need more website tips? Visit our <strong><a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/password-single-file-htaccess\/\">Website Tutorials<\/a><\/strong> section for additional resources.<\/p>\n\n\n<div class=\"jumbotron\" style=\"text-align:center;\">\r\n<p style=\"font-size: 20px;\"><strong>Scalable VPS Infrastructure, Fully Managed<\/strong><\/p>\r\n<p>When shared hosting can't handle your traffic, VPS delivers dedicated resources that scale with demand. Our team manages the technical complexity while you manage your business.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>NVMe Storage &nbsp;&nbsp; <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>High-Availability &nbsp;&nbsp; <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>Ironclad Security &nbsp;&nbsp; <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>Premium Support<\/p>\r\n<p><a class=\"btn btn-primary btn-lg\" href=\"https:\/\/www.inmotionhosting.com\/vps-hosting?mktgp=t&irgwc=1&affiliates=5001860&utm_campaign=Jumbotron&utm_source=supportcenter&utm_medium=cta&utm_term=vps-cta2\">VPS Hosting<\/a><\/p>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A 404 error occurs when a requested page is not found on your website. Instead of displaying a generic error message, you can create a custom 404 page to improve user experience and reduce bounce rates. What is a 404 Error? The 404 error (HTTP status code &#8220;404 Not Found&#8221;) occurs when a server cannot<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57032,"featured_media":129320,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4335],"tags":[],"class_list":["post-3976","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-error-numbers"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Set a Custom 404 Page Using .htaccess | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to set up a custom 404 page using .htaccess, redirect 404 errors, and follow SEO best practices to improve user experience.\" \/>\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.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set a Custom 404 Page Using .htaccess | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to set up a custom 404 page using .htaccess, redirect 404 errors, and follow SEO best practices to improve user experience.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-04T22:50:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-12T17:49:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Derrell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Derrell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\"},\"author\":{\"name\":\"Derrell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7\"},\"headline\":\"How to Set a Custom 404 Page Using .htaccess\",\"datePublished\":\"2021-05-04T22:50:00+00:00\",\"dateModified\":\"2025-02-12T17:49:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\"},\"wordCount\":764,\"commentCount\":31,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png\",\"articleSection\":[\"Website Error Numbers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\",\"name\":\"How to Set a Custom 404 Page Using .htaccess | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png\",\"datePublished\":\"2021-05-04T22:50:00+00:00\",\"dateModified\":\"2025-02-12T17:49:15+00:00\",\"description\":\"Learn how to set up a custom 404 page using .htaccess, redirect 404 errors, and follow SEO best practices to improve user experience.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png\",\"width\":1200,\"height\":630,\"caption\":\"How to Set a Custom 404 Page Using .htaccess\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set a Custom 404 Page Using .htaccess\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7\",\"name\":\"Derrell\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/derrell-willis\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/derrellw\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Set a Custom 404 Page Using .htaccess | InMotion Hosting","description":"Learn how to set up a custom 404 page using .htaccess, redirect 404 errors, and follow SEO best practices to improve user experience.","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.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/","og_locale":"en_US","og_type":"article","og_title":"How to Set a Custom 404 Page Using .htaccess | InMotion Hosting","og_description":"Learn how to set up a custom 404 page using .htaccess, redirect 404 errors, and follow SEO best practices to improve user experience.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2021-05-04T22:50:00+00:00","article_modified_time":"2025-02-12T17:49:15+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png","type":"image\/png"}],"author":"Derrell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Derrell","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/"},"author":{"name":"Derrell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7"},"headline":"How to Set a Custom 404 Page Using .htaccess","datePublished":"2021-05-04T22:50:00+00:00","dateModified":"2025-02-12T17:49:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/"},"wordCount":764,"commentCount":31,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png","articleSection":["Website Error Numbers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/","name":"How to Set a Custom 404 Page Using .htaccess | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png","datePublished":"2021-05-04T22:50:00+00:00","dateModified":"2025-02-12T17:49:15+00:00","description":"Learn how to set up a custom 404 page using .htaccess, redirect 404 errors, and follow SEO best practices to improve user experience.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png","width":1200,"height":630,"caption":"How to Set a Custom 404 Page Using .htaccess"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/set-custom-404-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Set a Custom 404 Page Using .htaccess"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7","name":"Derrell","sameAs":["https:\/\/www.linkedin.com\/in\/derrell-willis"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/derrellw\/"}]}},"jetpack_featured_media_url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/05\/custom-404-page.png","jetpack_sharing_enabled":true,"primary_category":{"id":4335,"name":"Website Error Numbers","slug":"error-numbers","link":"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57032"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3976"}],"version-history":[{"count":17,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3976\/revisions"}],"predecessor-version":[{"id":129323,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3976\/revisions\/129323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media\/129320"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}