我使用Piwik来跟踪我的网站访问者。 作为一个“安全”的问题,我只允许访问index.php几个已知的IP地址。 我的问题是,Piwikselect退出片段只能通过这个index.php 。
我试图通过RewriteRule的和Location / Files指令来解决这个问题,但是我不能只允许特定的URL参数,而让别人拒绝。
对于所有那些不了解(很多)Piwik而是Apache这些人的基本要点:
index.php访问,它只能访问已知的IP。 index.php使用已知的参数设置: index.php?module=CoreAdminHome&action=optOut&lang=DE 我想要的是:
index.php 。 (完成) index.phpselect退出参数集。 (待定) 如何只允许在Apache中的特定参数的URL?
我试过了:
Order allow,deny Allow from all <Files "index.php"> Order allow,deny Deny from all Allow from 127.0.0.1 </Files> RewriteEngine On RewriteRule ^/piwik-opt-out.html$ index.php?module=CoreAdminHome&action=optOut [L] <Location "/piwik-opt-out.html"> Order allow,deny Allow from all </Location>
我认为你可以缩小规则:
RewriteEngine on RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1 RewriteCond %{QUERY_STRING} !action=optOut RewriteRule index.php - [R=401]