I use a htaccess basic auth on my Woocommerce site to help prevent bots accessing wp-login, which works well... except with woocommerce if a logged in customer wants to logout from their account - upon clicking the logout link - they are greeted by the Basic Auth popup asking them to "authorise" (generated by our htaccess).
On Woocommerce dashboard: the link looks like this:
Hello MrTest (not MrTest ? Log out) << clicking on Log out brings up the Basic Auth login box.... how can we avoid that ?
Here is the content of our htaccess:
www.example.com/shop/my-account/customer-logout/?_wpnonce=2e343434
So how to change the htaccess to allow "wp-login.php?action=logout" to pass through the basic auth?
I tried this but it fails to work; I have Apache server with cPanel latest versions.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-login.php$
RewriteCond %{QUERY_STRING} ^action=logout
RewriteRule ^ - [E=noauth]
</IfModule>
<FilesMatch "^(wp-login.php)">
AuthName "Protected page"
AuthType Basic
AuthUserFile "/home/user/.pwrdfile"
Require valid-user
Order Deny,Allow
Deny from all
Allow from env=noauth
Satisfy any
</FilesMatch>
On Woocommerce dashboard: the link looks like this:
Hello MrTest (not MrTest ? Log out) << clicking on Log out brings up the Basic Auth login box.... how can we avoid that ?
Here is the content of our htaccess:
In WooCommerce settings, the Logout endpoint is: "customer-logout" and the logout link URL shows:AuthName "Authorized"
AuthType Basic
AuthUserFile /home/user/.pswrdfile
require valid-user
www.example.com/shop/my-account/customer-logout/?_wpnonce=2e343434
So how to change the htaccess to allow "wp-login.php?action=logout" to pass through the basic auth?
I tried this but it fails to work; I have Apache server with cPanel latest versions.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-login.php$
RewriteCond %{QUERY_STRING} ^action=logout
RewriteRule ^ - [E=noauth]
</IfModule>
<FilesMatch "^(wp-login.php)">
AuthName "Protected page"
AuthType Basic
AuthUserFile "/home/user/.pwrdfile"
Require valid-user
Order Deny,Allow
Deny from all
Allow from env=noauth
Satisfy any
</FilesMatch>