0

i want to make some pages password protected using .htpasswd

How can i do it ??

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

# Auth stuff
AuthUserFile /home1/thetimh6/public_html/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

I am try it in my htaccess file but it is showing me

500 Server Error

floriank
  • 25,546
  • 9
  • 42
  • 66

2 Answers2

0

Put the following code in .htaccess in public_html

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /path/to/.htpasswd
Require valid-user

Then create a .htpasswd, but put it OUTSIDE public_html

So the /path/to/.htpasswd is pointing to that location

kingtut007
  • 89
  • 8
-1

It's quite possible I'm thinking too simple here, but shouldn't the code:

AuthUserFile /home1/thetimh6/public_html/htpasswd

be:

AuthUserFile /home1/thetimh6/public_html/.htpasswd
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • No not working You can check here https://www.thetimelesspearlwholesale.com/product-category/earrings, username and password is admin – Designer shiba Mar 08 '16 at 19:06