0

I'm tiring to implement htaccess password protection for my WordPress site, users need to see my site after enter htaccess username and password, i used below codes and it shows password enter box,

My htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile .htpasswd 
AuthGroupFile /dev/null 
require valid-user
<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 141.101.99.132
deny from 173.245.53.65
deny from 173.245.53.74

but after enter password it shows server error messages

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@daqta.lixdea.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

my site is http://www.daqta.com/ username- test , password- test

Cœur
  • 37,241
  • 25
  • 195
  • 267
Suneth Kalhara
  • 1,211
  • 6
  • 20
  • 40
  • are you able to access the site without the htaccess? as in if the site runs on port 80, can you remove the password prompt and are able to access it? You'll be able to track it down to either an apache config error or an htaccess error. Looks like apache's trying to write to an error log but can't – Nick Brown Aug 22 '15 at 14:47
  • yes when i remove the password codes from htaccess site runs normally "AuthName "Restricted Area" AuthType Basic AuthUserFile .htpasswd AuthGroupFile /dev/null require valid-user" – Suneth Kalhara Aug 22 '15 at 15:17
  • Do you get any error messages in the /var/log/httpd/ logs? I'd look in the access_log to ensure that you see the access request and then error_log to see any additional detail – Nick Brown Aug 22 '15 at 15:20
  • i can't see that kind of folder – Suneth Kalhara Aug 22 '15 at 16:06
  • Have a look at http://stackoverflow.com/questions/7738170/how-to-debug-htaccess-rewrite-script to debug – Nick Brown Aug 22 '15 at 18:35

1 Answers1

0

Use something similar to this in your apache config.

<Location />
     AuthType Basic
     AuthName "username"
     AuthUserFile /etc/httpd/htpasswd
        Require valid-user
</Location>

Where /etc/httpd/htpasswd is a password file

Arjang
  • 731
  • 1
  • 10
  • 19