allow php file access protected folder by .htpasswd?

1.5k Views Asked by At

I have a site www.abc.domain.com, I protected it with .htpasswd. Now I have other www.domainname.com that contains a file callback.php, it requests to www.abc.domain.com. How do I write .htaccess file for both protecting www.abc.domain.com & allow file *.php from outside to access this secure folder? I have many callback.php around the web, in any domain, any hosting.

Thank you

2

There are 2 best solutions below

0
remy On

Modify your callback scripts to access the domain with the credentials.

Another easy way would be to disable the protection for the IPs of the other hosts.

3
Vyktor On

You should take a careful look at apache auth tutorials and documentation.

You're probably going to use Satisfy Any and add list of known hosts.

You also may try using FilesMatch or DirectoryMatch and build block like this:

<Directory ...>
   YourAuthConfig

   <FilesMatch  "/callback.php$">
       Allow from all
       Order allow,deny
       Satisfy any
   </FilesMatch>
</Directory>

(I'm not sure whether this will work, please let me know in a comment)