• Hi, I have already commented on your site but was not sure if it would be better here.
    I am having a problem when I am using the advanced code you are providing for the .htaccess.

    I am using Woocommerce and if I don’t use the code, it works, but if I add it to my .htaccess, I cannot add anything to my cart – instead of the cart the product page is displayed, even if I disable caching for cart and checkout page.

    I have a piece of code that you provided about a year ago and it is a bit different, and this code still works w/o problems, so I was wondering if I cn still use the old code. It is this one:

    # BEGIN Cache Enabler
    <ifmodule mod_rewrite.c="">
    RewriteEngine On
    
    <ifmodule mod_mime.c="">
    # gzip HTML file
    RewriteCond %{REQUEST_URI} /$
    RewriteCond %{REQUEST_URI} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f
    RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L]
    
    AddType text/html .gz
    AddEncoding gzip .gz
    </ifmodule>
    
    # default HTML file
    RewriteCond %{REQUEST_URI} /$
    RewriteCond %{REQUEST_URI} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html -f
    RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html [L]
    </ifmodule>
    # END Cache Enabler

    Also, I noticed that there still is a problem with the stock status – a product is still displayed as being in stock when the page is cached…

    Thank you for your help!

Viewing 12 replies - 1 through 12 (of 12 total)
  • We have tested the current advanced snippet on a new installation of WordPress and it is working without any issues. It sounds as though there may be a conflict with your setup or another plugin. In this case, I would recommend not using the advanced snippet at all (including the one you have mentioned). In our most recent update of Cache Enabler we have made significant improvements and the advanced snippet only produces a very very minimal speed enhancement.

    As for the stock issue. This seems to also be working correctly on our default setup. Have you tried disabling other plugins to see if there is a conflict elsewhere? Also does the stock feature work when the advanced snippet isn’t used?

    Thread Starter danina84

    (@danina84)

    Thank you for your reply.
    I just set up a fresh install of WP and Woocommerce. I have no other plugins beside Woo and yours. No extra code added. Still, the stock status shows “in stock”, and when you try to put the item in your cart, you cant and are getting the error message”Sorry this product is not in stock”. But it should not display “in stock” on the product page in first place!

    Thread Starter danina84

    (@danina84)

    I have a few things in my htaccess already, could these be causing a conflict? I have the following:

    `php_value memory_limit 256M
    php_value max_execution_time 300

    #GZIP
    <IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    </IfModule>

    #CACHING
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault “access 5 seconds”
    ExpiresByType image/jpg “access 1 month”
    ExpiresByType image/jpeg “access 1 month”
    ExpiresByType image/gif “access 1 month”
    ExpiresByType image/png “access 1 month”
    ExpiresByType image/ico “access 1 month”
    ExpiresByType image/x-icon “access 1 month”
    ExpiresByType image/svg+xml “access 1 month”
    ExpiresByType text/css “access 1 month”
    ExpiresByType text/javascript “access 1 month”
    ExpiresByType application/javascript “access 1 month”
    ExpiresByType application/x-javascript “access 1 month”
    ExpiresByType application/x-shockwave-flash “access 1 month”
    </IfModule>

    #CACHE-CONTROL, KEEP ALIVE, ETAGS
    <IfModule mod_headers.c>
    Header append Cache-Control “public”
    Header append Vary Accept-Encoding
    Header set Connection keep-alive
    Header unset ETag
    FileETag None
    </IfModule>

    # DENY ACCESS TO .HTACCESS
    <FilesMatch “(\.htaccess|\.htpasswd)”>
    Order deny,allow
    Deny from all
    </FilesMatch>

    # PREVENT DIRECTORY LISTINGS
    Options -Indexes

    # DISALLOW ACCESS TO IMPORTANT FILES
    <FilesMatch “(^\.|wp-config\.php|xmlrpc\.php|(?<!robots)\.txt|(liesmich|readme)\.*)”>
    Order deny,allow
    Deny from all
    </FilesMatch>

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Does clearing the cache resolve the issue? In other words, when your product is out of stock but the page still shows “in stock” does clearing the cache properly render the page to show “out of stock”?

    Thread Starter danina84

    (@danina84)

    Yes it does!

    Thread Starter danina84

    (@danina84)

    Is there any way to avoid this? I don’t want to have to exclude the product page since it is on my front page…
    And were you able to have a look at my htaccess? Is this okay with your plugin?

    Thank you so much!

    Unfortunately, I am unable to reproduce the error you’re experiencing. I did test your .htaccess with our default setup and it still works as expected. Whenever I changed the stock value for a product and refreshed the page (Logged out of WP) the stock updated without having to empty the CE cache.

    For testing purposes have you tried removing all of your additional .htaccess content and just having the default WP?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    Thread Starter danina84

    (@danina84)

    Hi,
    thanks for your reply.
    Regarding the stock: I am not talking about the stock not updating correctly when you change it in the admin, but intstead when a customer is buying a product that is still in stock. So let’s say there is one item left, a customer buys it and then the product page still displays the item being in stock because it is still cached – but it should update when a customer buys the last one!

    Okay thanks for the info. Will perform some more testing and get back to you.

    Thread Starter danina84

    (@danina84)

    Hi there,
    I just wanted to let you know that I have tried two other caching plugins and they update the stock status display correctly when a customer buys an item, so there is a way. But overall, I prefer your plugin because it is faster ?? So I would really appreciate if you could implement the correct stock display as soon as possible…

    Thanks!

    Thanks for the feedback.

    We have been able to reproduce the issue as you mentioned. This has been passed along to the devs for further troubleshooting.

    Thread Starter danina84

    (@danina84)

    Thank you, I really hope this can be solved!
    regarding the htacess modification: My host had a look at it and checked why we are getting a white screen when implementing your code, and it seems to have an additional [END] that is not needed. My host changed your code to this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    #RewriteEngine On
    #RewriteBase /
    #RewriteRule ^index\.php$ - [L]
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . /index.php [L]
    RewriteEngine On
    RewriteBase /
    
    # set blog sub path
    SetEnvIf Request_URI "^(.*)$" SUB_PATH=/wp-content/cache/cache-enabler/
    
    # set Cache Enabler path
    SetEnvIf Request_URI "^(.*)$" CE_PATH=$1
    SetEnvIf Request_URI "^(/)index.php$" CE_PATH=$1
    
    <IfModule mod_mime.c>
    # webp HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTP:Accept} image/webp
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz [L]
    
    # gzip HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz [L]
    
    AddType text/html .gz
    AddEncoding gzip .gz
    </IfModule>
    
    # webp HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept} image/webp
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html [L]
    
    # default HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html [L]
    
    # wp override
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    

    So your code is in the WordPress code, not above…now the site is working, but I am not sure if the code really does anything because the site is not faster…

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Problem with Woocommerce’ is closed to new replies.