Last active
December 6, 2019 07:14
-
-
Save lukapaunovic/8bb9240d999a1e933fd2d6bb6995d9fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable Woocommerce cart fragments for homepage via .htaccess | |
# By creating empty response | |
# Please replace yoursite.com | |
# Disable only on homepage | |
RewriteEngine On | |
RewriteCond %{HTTP_REFERER} ^https://yoursite.com/$ [NC] | |
RewriteCond %{QUERY_STRING} ^wc-ajax=get_refreshed_fragments$ | |
RewriteRule ^(.*)$ $1 [R=204,L] | |
# Disable everywhere | |
RewriteEngine On | |
RewriteCond %{QUERY_STRING} ^wc-ajax=get_refreshed_fragments$ | |
RewriteRule ^(.*)$ $1 [R=204,L] |
@jayeq, if you are using the method which uses 404.php file then you need to create that file, of course.
The content of the 404.php file should be:
<?php
http_response_code(204);
die();
Then in waterfall u should see 204 response instead of 500 error.
I used your settings all the time and it was great!
It doesn't work anymore. Could give new instructions ..?
My site
WooCommerce 3.8.1
WordPress 5.3
PHP 7.4
MySQL 5.7.16-10-log
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Didn't work for me (tried disabling everywhere) but the alternative seems better for me. It does cause a 500 error based on the waterfall but at least it's quick vs. the 1s+ the call was taking before. Thanks!
As for that internal error, it makes me believe something's not right since it should be finding the 404.php file I created, no??? Any ideas on how to fix that? Sometimes, it's taking >500ms to return the 500 error...