{"id":2633,"date":"2022-09-29T09:48:11","date_gmt":"2022-09-29T09:48:11","guid":{"rendered":"https:\/\/tronsdev.com\/tronsit.au\/?p=1696"},"modified":"2022-09-29T09:48:11","modified_gmt":"2022-09-29T09:48:11","slug":"disable-404-redirects-in-wordpress","status":"publish","type":"post","link":"https:\/\/tronsdev.com\/tronsit\/disable-404-redirects-in-wordpress\/","title":{"rendered":"Disable 404 Redirects in WordPress"},"content":{"rendered":"<h1>How to Disable 404 Redirects in WordPress<\/h1>\n<p>Ever been through a situation where you tried to access a website and browser displayed \u2018Error 404- Page not found\u2019? wonder what just went wrong?<br \/>\n404 are broken links on a website which redirect users to the error page suggesting that the website or some of its content does not exist. This certainly makes users leave the website, this makes it important for webmasters to remove all 404 redirects.<br \/>\nDisabling 404 redirects in a WordPress website can be done by editing its .htaccess file. This guide will let you know about all possible ways to remove 404 redirects considering the type of errors that might appear on a WordPress website.<br \/>\n<span style=\"font-weight: 400;\">To begin with the process, you need to:<\/span><\/p>\n<ul>\n<li><b>Locate the .htaccess file of a WordPress website<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The .htaccess file is found in the root folder of WordPress installation. To access the file, you will have to either use FTP &#8211; file transfer protocol &#8211; or access it via website\u2019s cPanel. Once that the file is accessed force show the hidden files to make changes.\u00a0<\/span><\/p>\n<ul>\n<li><b>Create a backup<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">You cannot risk crashing the website, can you? To enable to process safely, download a copy of WordPress files especially the .htaccess file before making any changes.\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\">Once that you open the .htaccess file you shall find the following code:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"># BEGIN WordPress<\/span>\n<span style=\"font-weight: 400;\">RewriteEngine On<\/span>\n<span style=\"font-weight: 400;\">RewriteBase \/<\/span>\n<span style=\"font-weight: 400;\">RewriteRule ^index\\.php$ - [L]<\/span>\n<span style=\"font-weight: 400;\">RewriteCond %{REQUEST_FILENAME} !-f<\/span>\n<span style=\"font-weight: 400;\">RewriteCond %{REQUEST_FILENAME} !-d<\/span>\n<span style=\"font-weight: 400;\">RewriteRule . \/index.php [L]<\/span>\n<span style=\"font-weight: 400;\"># END WordPress<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This chunk of code is the basic added by WordPress however, you might also find other blocks of codes written in the .htaccess file. Do not try to edit any of it as they may contain the basic functionalities of a WordPress website.\u00a0<\/span><\/p>\n<ul>\n<li><b>Begin the redirection<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The most efficient way of dealing with 404 redirects is to use 301 redirect to bring traffic back to homepage rather than making them view the \u2018Error 404-Page not found\u2019. By modifying and pasting the following set of codes in the .htaccess file you can easily do that:\u00a0<\/span><\/p>\n<h4>Redirect Individual Page<\/h4>\n<p><span style=\"font-weight: 400;\">This code will send website traffic from \u2018old page\u2019 to \u2018new page\u2019 that you want them to see.\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\">Redirect 301 \/oldpage.html http:\/\/www.yoursite.com\/newpage.html<\/span><\/p>\n<h4>Redirect all files from a directory<\/h4>\n<p><span style=\"font-weight: 400;\">With this code you will allow users to access files from the directory \u2018people\u2019 from \u2018www.yoursite.com\/\u00a0<\/span><\/p>\n<h4>Redirect 301 \/people http:\/\/www.yoursite.com\/<\/h4>\n<p><span style=\"font-weight: 400;\">Redirect full website<\/span><br \/>\n<span style=\"font-weight: 400;\">This code will let you redirect all users that access any page of a website to \u2018www.yoursite.com\/.\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\">Redirect 301 \/ http:\/\/www.yoursite.com\/<\/span><br \/>\n<span style=\"font-weight: 400;\">Another effective way of optimising redirects is to edit the <\/span><b>Permalinks settings.\u00a0<\/b><\/p>\n<ul>\n<li><b>Create shorter Permalinks<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">To shorten the permalinks and make the URL look neat use the following code:\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">RewriteEngine On<\/span>\n<span style=\"font-weight: 400;\">RewriteBase \/<\/span>\n<span style=\"font-weight: 400;\">RewriteRule ^category\/(.+)$ http:\/\/mydomain.com\/$1 [R=301,L]<\/span>\n<span style=\"font-weight: 400;\">RewriteRule ^index\\.php$ - [L]<\/span>\n<span style=\"font-weight: 400;\">RewriteCond %{REQUEST_FILENAME} !-f<\/span>\n<span style=\"font-weight: 400;\">RewriteCond %{REQUEST_FILENAME} !-d<\/span>\n<span style=\"font-weight: 400;\">RewriteRule . \/index.php [L]<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Once that the changes are made, save the .htaccess file but do not forget to redirect your website according to the new permalinks.\u00a0<\/span><\/p>\n<ul>\n<li><b>Test the website<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">After that changes are saved, test run the WordPress website to look for any 404 redirects if still found.\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\">There you go, you are done!\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\">You may easily find WordPress compatible plugins to redirect 404s to the homepage. Among these are \u2018All 404 Redirect to Homepage\u2019, \u2018SEO Redirection Plugin\u2019 and many more.\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\">Let us know how this guide helped you! Have any ambiguities? Ask now!\u00a0 <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Disable 404 Redirects in WordPress Ever been through a situation where you tried to access a website and browser displayed \u2018Error 404- Page not found\u2019? wonder what just went wrong? 404 are broken links on a website which redirect users to the error page suggesting that the website or some of its content &#8230; <a title=\"Disable 404 Redirects in WordPress\" class=\"read-more\" href=\"https:\/\/tronsdev.com\/tronsit\/disable-404-redirects-in-wordpress\/\" aria-label=\"Read more about Disable 404 Redirects in WordPress\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":2752,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[26],"class_list":["post-2633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-development","tag-website-development"],"_links":{"self":[{"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/posts\/2633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/comments?post=2633"}],"version-history":[{"count":0,"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/posts\/2633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/media\/2752"}],"wp:attachment":[{"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/media?parent=2633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/categories?post=2633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tronsdev.com\/tronsit\/wp-json\/wp\/v2\/tags?post=2633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}