Would anyone know how to modify the .htaccess to fix this? Apologies, I sense that this is an easy fix, but I don’t understand enough to do it myself so would appreciate any help.
Thank you !! Your QUERY_STRING did the trick! I didn’t have to change index.php to matomo-proxy.php in the end. This is the final .htaccess that works for me now:
<Files "*">
AuthType Basic
AuthName "Piwik"
# to be explicit, state the provider
AuthBasicProvider file
AuthUserFile "/PATH/TO/.htpasswd"
Require valid-user
</Files>
# Allow external access to piwik.php and piwik.js and robots.txt
<FilesMatch "(^piwik\.(php|js)|robots\.txt)">
Require all granted
</FilesMatch>
# Allow Opt-Out
<Files "index.php">
<If "(%{QUERY_STRING} =~ /^module\=CoreAdminHome\&action\=optOut/)">
Require all granted
</If>
</Files>
I will add this to the original .htaccess instructions thread to help others at my level.