简体   繁体   中英

Lock Wordpress /wp-admin/ using password with Apache 2.4

I want to lock down /wp-admin/ area with a login and password. On Apache 2.3, I used to config my /var/www/html/wp-admin/.htaccess like this:

AuthType Basic
AuthName "Restricted files"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
<Files admin-ajax.php>
    Order allow,deny
    Allow from all
    Satisfy any
</Files>

How the same configuration is done on Apache 2.4?

Apache 2.4 is exactly the same as 2.2 for password protecting a directory. I use this on a number of sites running on 2.4:

AuthType Basic
AuthName "Restricted Access"
AuthUserFile /this/is/your/dir/.htpasswd
Require valid-user

Then you obviously have your .htpasswd file which looks like:

admin:Umvdgh40rXES3ChsKg444

For access to your file in Apache 2.4:

<Files admin-ajax.php>
    Require all granted
</Files>

You can view the Apache Documentation for the upgrade by following this link http://httpd.apache.org/docs/2.4/upgrading.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM