{"id":5305,"date":"2022-01-30T10:04:10","date_gmt":"2022-01-30T10:04:10","guid":{"rendered":"https:\/\/www.futurestatemedia.com\/?p=5305"},"modified":"2022-01-30T10:20:22","modified_gmt":"2022-01-30T10:20:22","slug":"solving-woocommerce-404-error-on-product-pages","status":"publish","type":"post","link":"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/","title":{"rendered":"Solving WooCommerce 404 Error on Product Pages &#038; More"},"content":{"rendered":"<p class=\"wp-block-paragraph\">WooCommerce 404 errors can be common, especially when your plugin stack gets even mildly complex. One of the most common reasons for the 404 error is a failed automatic update or corrupt edit of the .htaccess file.<\/p>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Reasons_for_the_WooCommerce_404_Error\"><\/span>Reasons for the WooCommerce 404 Error<span class=\"ez-toc-section-end\"><\/span><\/h2><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6abf018aa6aa5\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6abf018aa6aa5\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/#Reasons_for_the_WooCommerce_404_Error\" >Reasons for the WooCommerce 404 Error<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/#Solving_a_Corrupt_htacess_File_Causing_WooCommerce_404_Error_%E2%80%93_Short_Term\" >Solving a Corrupt .htacess File Causing WooCommerce 404 Error &#8211; Short Term<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/#If_you_can_still_login_to_the_backend_of_WordPress\" >If you can still login to the backend of WordPress:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/#If_you_cant_login_to_the_backend_of_WordPress\" >If you can&#8217;t login to the backend of WordPress:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/#Solving_a_Corrupt_htaccess_File_Causing_WooCommerce_404_Problem_%E2%80%93_Long_Term\" >Solving a Corrupt .htaccess File Causing WooCommerce 404 Problem &#8211; Long Term<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/#Solving_A_Clash_With_A_Category_Or_Attribute_URL_Base_Causing_WooCommerce_404_Error\" >Solving A Clash With A Category Or Attribute URL Base Causing WooCommerce 404 Error<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<ol class=\"wp-block-list\"><li>A corrupt .htaccess file caused by a plugin, WooCommerce or WordPress itself<\/li><li>You&#8217;ve added a category or attribute with the base &#8216;\/product\/&#8217; which is in conflict with WooCommerce Product Permalink settings<\/li><\/ol>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Solving_a_Corrupt_htacess_File_Causing_WooCommerce_404_Error_%E2%80%93_Short_Term\"><\/span>Solving a Corrupt .htacess File Causing WooCommerce 404 Error &#8211; Short Term<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Many WooCommerce and WordPress plugins add code to the .htaccess file and interact with the code placed within it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your WordPress Caching Plugin will be adding caching directives&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your WordPress Security Plugin will be adding security protocols, whitelisted IPs etc&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your core WooCommerce settings will be adding directives for permalink structures etc&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There&#8217;s a whole list<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The great news is there&#8217;s a VERY simple fix to the WooCommerce 404 error when it&#8217;s caused by a corrupt .htaccess file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"If_you_can_still_login_to_the_backend_of_WordPress\"><\/span>If you can still login to the backend of WordPress:<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Head to Settings &gt; Permalinks<\/li><li>Click &#8220;Save&#8221; at the bottom of the page (no need to change anything)<\/li><li>Flush the Cache for good measure<\/li><li>Verify the fix has worked in incognito \/ from a different Wifi connection<\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"If_you_cant_login_to_the_backend_of_WordPress\"><\/span>If you can&#8217;t login to the backend of WordPress:<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Head over to your host and login<\/li><li>Go to the &#8220;file manager&#8221; section (exact location will differ depending on <a href=\"https:\/\/www.futurestatemedia.com\/en\/siteground-recommended-woocommerce-hosting\/\">which WooCommerce Host<\/a> you&#8217;re using)<\/li><li>Make a copy of the .htaccess file<\/li><li>Rename the old .htaccess file to something like .htaccess1<\/li><li>Copy and paste a <a href=\"https:\/\/wordpress.org\/support\/article\/htaccess\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">default WordPress .htaccess file<\/a> from here into your new .htaccess file<\/li><li>Save the new .htaccess file<\/li><li>Flush the cache from the hosting dashboard (if you can)<\/li><li>Verify the fix has worked in incognito \/ from a different Wifi connection<\/li><\/ol>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Solving_a_Corrupt_htaccess_File_Causing_WooCommerce_404_Problem_%E2%80%93_Long_Term\"><\/span>Solving a Corrupt .htaccess File Causing WooCommerce 404 Problem &#8211; Long Term<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">As the solution basically involves &#8220;Clicking Save&#8221; on the Permalinks settings page inside WordPress, this is definitely something that can be automated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All you need to do is add a cron job to flush the .htaccess file frequently to limit the time for which the error can actually occurr.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What the hell is a cron job you say?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t panic &#8211; all you ACTUALLY need to do is add a code snippet using the &#8220;Code Snippets&#8221; plugin and click &#8220;Save and Activate&#8221; and you&#8217;re DONE. NO Code knowledge necessary &#8211; it&#8217;s child&#8217;s play.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the code you need to add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Flush permalinks every hour \nadd_action('my_hourly_event', 'do_this_hourly');\n \nfunction my_activation() {\n    if ( !wp_next_scheduled( 'my_hourly_event' ) ) {\n        wp_schedule_event(time(), 'hourly', 'my_hourly_event');\n    }\n}\n \nadd_action('wp', 'my_activation');\n \nfunction do_this_hourly() {\n    global $wp_rewrite;\n    $wp_rewrite-&gt;flush_rules();\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Full credit for this code, and original source is isitwp.com &#8211; <a href=\"https:\/\/www.isitwp.com\/flush-permalinks-once-per-hour-cron-job\/\" target=\"_blank\" rel=\"noreferrer noopener\">see the original code here<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And here&#8217;s the code snippets plugin if you&#8217;ve not already got it installed:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-plugin-directory wp-block-embed-plugin-directory\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"HL0O8pMPdD\"><a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noopener\">Code Snippets<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Code Snippets&#8221; &#8212; Plugin Directory\" src=\"https:\/\/wordpress.org\/plugins\/code-snippets\/embed\/#?secret=Qv8sdAyOY4#?secret=HL0O8pMPdD\" data-secret=\"HL0O8pMPdD\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Solving_A_Clash_With_A_Category_Or_Attribute_URL_Base_Causing_WooCommerce_404_Error\"><\/span>Solving A Clash With A Category Or Attribute URL Base Causing WooCommerce 404 Error<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">As you&#8217;ll see on this <a href=\"https:\/\/github.com\/woocommerce\/woocommerce\/issues\/14481\" target=\"_blank\" rel=\"noopener\">drawn out thread on Github<\/a> &#8211; this is more of a common caused of a WooCommerce 404 problem than I&#8217;d EVER have anticipated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It basically means that an admin level user has intentionally created a &#8220;Post Category&#8221; or &#8220;Product Attribute&#8221; with the name &#8220;Product&#8221; &#8211; this means the slug for that category or attribute includes \/product\/ which is ALSO the default slug (permalink) for Product pages in WooCommerce.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This naturally leads to a conflict and means you&#8217;ve got a &#8220;human error&#8221; cause &#8211; and the technology hasn&#8217;t prevented that human error from occurring. Sometimes (a lot of the time) software just isn&#8217;t &#8220;<a href=\"https:\/\/asq.org\/quality-resources\/mistake-proofing\" rel=\"noreferrer noopener nofollow\" target=\"_blank\">poka yoke<\/a>&#8221; and human error mistakes are allowed by the software when they shouldn&#8217;t be.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At some point in the future &#8211; this may well change and this error will become impossible &#8211; but for now, just watch out for rogue store owners and clients who could be causing some head scratching for you, the website manager!<\/p>","protected":false},"excerpt":{"rendered":"<p>WooCommerce 404 errors can be common, especially when your plugin stack gets even mildly complex. One of the most common reasons for the 404 error is a failed automatic update or corrupt edit of the .htaccess file. Reasons for the WooCommerce 404 Error A corrupt .htaccess file caused by a plugin, WooCommerce or WordPress itself&hellip; <a class=\"more-link\" href=\"https:\/\/www.futurestatemedia.com\/en\/solving-woocommerce-404-error-on-product-pages\/\">Continue reading <span class=\"screen-reader-text\">Solving WooCommerce 404 Error on Product Pages &#038; More<\/span><\/a><\/p>","protected":false},"author":3,"featured_media":5310,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[24],"tags":[],"class_list":["post-5305","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-amazon-fba","entry"],"_links":{"self":[{"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/posts\/5305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/comments?post=5305"}],"version-history":[{"count":0,"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/posts\/5305\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/media\/5310"}],"wp:attachment":[{"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/media?parent=5305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/categories?post=5305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.futurestatemedia.com\/en\/wp-json\/wp\/v2\/tags?post=5305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}