0

I want to password protect a Zend URL. /User/Profile.

I can successfully password protect User controller but I want only one method protected.

Following works for me on full controller

AuthName "Restricted Area" 
AuthType Basic
AuthUserFile  /XXX/.htpasswd
<Files User>
  require valid-user
</Files>

But I want something like this.

AuthName "Restricted Area" 
AuthType Basic
AuthUserFile  /XXX/.htpasswd
<Files "User/profile">
  require valid-user
</Files>
mysterious
  • 1,450
  • 5
  • 29
  • 56

1 Answers1

0

This answer helped me.

# Do the regex check against the URI here, if match, set the "require_auth" var
SetEnvIf Request_URI ^/pretty/url require_auth=true

# Auth stuff
AuthUserFile /var/www/htpasswd
AuthName "Password Protected"
AuthType Basic

# Setup a deny/allow
Order Deny,Allow
# Deny from everyone
Deny from all
# except if either of these are satisfied
Satisfy any
# 1. a valid authenticated user
Require valid-user
# or 2. the "require_auth" var is NOT set
Allow from env=!require_auth
Community
  • 1
  • 1
mysterious
  • 1,450
  • 5
  • 29
  • 56