Search code examples
php.htaccesscurldirectoryprotected

Files in htaccess protected folder read by PHP script in the same folder


I have a folder protected by .htaccess (digest authentication). I need to read outputs of some scripts located in subfolders of this folder using file_get_contents. This reading script is located in the protected folder root. It can't perform the file_get_contents function because of the folder protection. Is there any way to allow certain PHP scripts to operate in the folder by some htaccess settings so I won't have to create some cURL based login sessions in the scripts?


Solution

  • You can create rewrite rules based on useragent string. And then in your curl request you need to set a usearagent string allowed in your htaccess file.