{"id":9241,"date":"2023-12-13T04:48:19","date_gmt":"2023-12-13T04:48:19","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?post_type=manual_kb&#038;p=9241"},"modified":"2025-11-22T04:47:41","modified_gmt":"2025-11-22T04:47:41","slug":"how-to-redirect-your-404-pages","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/how-to-redirect-your-404-pages\/","title":{"rendered":"How to Redirect your 404 pages to the Home Page in WordPress"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This article will cover how to redirect your 404 pages to the home page in WordPress.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">404- Page not found error can increase your website's bounce rate of your website but redirecting your 404 pages to the home page can help your users find the valuable thing on your website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most users who visit your website and find the 404 pages will quit, increasing the overall bounce rate and negative impact on your website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, let's see how we can redirect 404 pages to the home page in WordPress.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are two ways by which you can redirect all the 404 pages to the home page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1 By entering manual code<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2 By using the Rank Math SEO plugin<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>By adding a code manually<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\">\n<li>Log in to your control panel. Here I am taking the DirectAdmin panel. After login, scroll down and click on the \"File Manager\" icon.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"589\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/1-1.png\" alt=\"File Manager\" class=\"wp-image-4388\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/1-1.png 956w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/1-1-768x473.png 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/1-1-810x499.png 810w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2. Navigate to the domain and double-click on it. Select your domain name(if you have multiple domains), then double-click on the public_html folder.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"603\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/2-1.png\" alt=\"public_html\" class=\"wp-image-4389\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/2-1.png 1043w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/2-1-768x444.png 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/2-1-810x468.png 810w\" sizes=\"auto, (max-width: 1043px) 100vw, 1043px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3. WP_Content \u2192 themes folder and create a new file and name it 404.php<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1364\" height=\"423\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/3.jpg\" alt=\"404.php\" class=\"wp-image-4390\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/3.jpg 1364w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/3-768x238.jpg 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/3-810x251.jpg 810w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/3-1140x354.jpg 1140w\" sizes=\"auto, (max-width: 1364px) 100vw, 1364px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4. Edit 4.4.php, paste the code given below and save it.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\nheader(&quot;HTTP\/1.1 301 Moved Permanently&quot;);\nheader(&quot;Location: &quot;.get_bloginfo(&#039;url&#039;));\nexit();\n?&gt;\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1318\" height=\"565\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/4-2.png\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress - screenshot 1\" class=\"wp-image-4391\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/4-2.png 1318w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/4-2-768x329.png 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/4-2-810x347.png 810w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/4-2-1140x489.png 1140w\" sizes=\"auto, (max-width: 1318px) 100vw, 1318px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>By using the Rank Math SEO plugin<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1 Login to your WordPress dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2 Go to plugins\u2192 install <strong>Rank Math <\/strong>\u2192 Activate.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3 Go to <strong>Rank Math <\/strong>\u2192 Dashboard \u2192 Modules \u2192 Enable 404 monitor.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2401\" height=\"1057\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1.jpg\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress - screenshot 2\" class=\"wp-image-4394\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1.jpg 2401w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1-768x338.jpg 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1-1536x676.jpg 1536w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1-2048x902.jpg 2048w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1-810x357.jpg 810w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/5-1-1140x502.jpg 1140w\" sizes=\"auto, (max-width: 2401px) 100vw, 2401px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4 Go to 404 Monitor. You will reach to 404 error log screen.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"549\" height=\"416\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/6-2.png\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress - screenshot 3\" class=\"wp-image-4395\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5 Activate Advance 404 monitor by <strong>Rank Math \u2192 General Settings \u2192404 Monitor <\/strong>and click save.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"866\" height=\"581\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/7-1.png\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress - screenshot 4\" class=\"wp-image-4396\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/7-1.png 866w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/7-1-768x515.png 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/7-1-810x543.png 810w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">6 Navigate to Rank Math \u2192 404 Monitor. A list of URLs will appear which have returned 404 errors along with some other details like Referer, User-Agent etc.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"549\" height=\"416\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/6-2.png\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress - screenshot 5\" class=\"wp-image-4395\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">7 Mouse hover the URL for which you want to do the redirection and click on \u201c<strong>Redirect\u201d.<\/strong><br><strong>Note:- You can select multiple URLs too for bulk redirection.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"344\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/8.png\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress - screenshot 6\" class=\"wp-image-4398\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">8 The redirection page will open. Add the URL of the destination where you want to redirect.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"890\" height=\"588\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/11\/9.png\" alt=\"How to Redirect your 404 pages to the Home Page in WordPress\" class=\"wp-image-4399\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/9.png 890w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/9-768x507.png 768w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/9-810x535.png 810w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">9 Repeat steps 7 &amp; 8 for all the 404 URLs and clears the logs once you have done the redirection of every URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope this will be the article which you were looking for.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>You may also like<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/youstable.com\/blog\/how-to-change-link-color-in-wordpress\/\" target=\"_blank\" rel=\"noopener\"><strong>How to change link colour in WordPress?<\/strong><\/a><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/youstable.com\/blog\/display-breadcrumb-navigation-links-in-wordpress\/\" target=\"_blank\" rel=\"noopener\">How to Display Breadcrumb Navigation Links in WordPress?<\/a><\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/youstable.com\/blog\/how-to-add-expires-headers\/\" target=\"_blank\" rel=\"noopener\">How to Add Expires Headers To Your WordPress Website?<\/a><\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/youstable.com\/blog\/how-to-remove-wordpress-version\/\" target=\"_blank\" rel=\"noopener\">How to Remove WordPress Version Number?<\/a><\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/youstable.com\/blog\/how-to-change-background-color\/\" target=\"_blank\" rel=\"noopener\">How to Change Background Color in WordPress<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This article will cover how to redirect your 404 pages to the home page in WordPress. 404- Page not found [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6759,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"iawp_total_views":57,"footnotes":""},"categories":[350,2258],"tags":[],"class_list":["post-9241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase","category-kb-wordpress"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/9241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=9241"}],"version-history":[{"count":0,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/9241\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/6759"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=9241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=9241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=9241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}