htaccess 全部拒绝允许远程访问

htaccess deny all allow remote access

我正在尝试获取 .htaccess 以拒绝所有直接访问并且只允许从 Joomla Extension URL 安装程序访问。

我有一台服务器,这里的 installation/download 目录是 .htaccess。

我自己有多个服务器,我可以将这些 ip 添加到下面的代码中。但是我的客户网站想要在其他地方托管它呢?不断地用更多的 ip 地址更新 htaccess 有点困难。我猜这也不安全。

AuthName "Protected" 
AuthType Basic 
<Limit GET POST> 
order deny,allow 
deny from all 
allow from YOUR.SERVER.IP.ADDRESS 
</Limit> 

我能想到两种可能的解决方案,但不知道是否存在。

  1. 在 .htpasswd 中创建一个 user/pass 然后创建 htaccess:

    AuthName "Protected" 
    AuthType Basic 
    <Limit GET POST> 
    order deny,allow 
    deny from all 
    allow from valid-user 
    </Limit> 
    

    并制作link:

    http://example.com/download/install_something_v1.0?USERNAME&PASSWORD
    
  2. 修改htaccess,只允许通过脚本访问,不允许直接访问。

应要求,我将发表评论作为答复。

You can use a link with the following format:

http://USERNAME:PASSWORD@example.com/download/install_something_v1.0