Scenario
I'm simply trying to allow one php file through .htaccess password folder.
Attempts so far
- my-special-file.php
- subfolder/my-special-file.php
- ./subfolder/my-special-file.php
- tried using a .htaccess inside the subfolder
Question
What am I missing? I know I've gotten little things like this to work before but I'm just not seeing it..
.htaccess file
AuthUserFile /some/folder/.htpasswd
AuthType Basic
AuthName "Password Required"
Require user personA personB
Order Deny,Allow
Deny from All
#not working
<Files "./subfolder/my-special-file.php">
Allow from All
</Files>
Satisfy Any
Web Page 401
Unauthorized
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Apache/2.4.7 (Ubuntu) Server at x.x Port 80
The Access Control has changed in Apache 2.4 you are using, and the changes are probably best explained in the Upgrading to 2.4 from 2.2. In short, from mod_access_compat:
Let's refactor your configuration based on mod_authz_core and mod_authz_host:
<Directory>
context can be replaced with.htaccess
, although not recommended.The
<Files "my-special-file.php">
gets inherited by all the subfolders, i.e.my-special-file.php
,subfolder/my-special-file.php
etc.If you only want this to be applied to the
subfolder/my-special-file.php
, you'd need: