如何使用密码保护整个网站,但允许公共访问1个特定文件

时间:2021-12-06 03:40:54

I've created an e-commerce site that uses paypal to accept payment. I am in the testing phase so I have password protected the entire site using htaccess. The trouble is that I am using IPN to verify PayPal payments and therefor my IPN script needs to be publicly accessible so that PayPal can communicate with it.

我创建了一个使用paypal接受付款的电子商务网站。我正处于测试阶段,因此我使用htaccess密码保护整个站点。问题是我使用IPN来验证PayPal付款,因此我的IPN脚本需要公开访问,以便PayPal可以与之通信。

Is there a way to password protect the entire website except allow public access to 1 script file? (my ipn script file)

有没有办法密码保护整个网站,除了允许公共访问1个脚本文件? (我的ipn脚本文件)

I'm using PHP and here is my .htaccess that I'm using to password protect the entire site:

我正在使用PHP,这是我的.htaccess,我用来密码保护整个网站:

AuthName "Site Administratrion"
AuthUserFile /dir/.htpasswd
AuthGroupFile /dev/null

AuthName secure
AuthType Basic
require user username1
order allow,deny
allow from all

1 个解决方案

#1


8  

Put the IPN script in a subdirectory with its own .htaccess that explicitly disables HTTP authentication for the contents of that folder?

将IPN脚本放在具有自己的.htaccess的子目录中,该子目录明确禁用该文件夹内容的HTTP身份验证?

#1


8  

Put the IPN script in a subdirectory with its own .htaccess that explicitly disables HTTP authentication for the contents of that folder?

将IPN脚本放在具有自己的.htaccess的子目录中,该子目录明确禁用该文件夹内容的HTTP身份验证?