简体   繁体   English

使用htaccess限制对wordpress网站的访问

[英]Restrict access to wordpress site using htaccess

Just would like to ask how can I restrict access to my WordPress site using .htaccess file? 只是想问一下如何使用.htaccess文件限制对WordPress网站的访问?

I have seen sites that teaches how to protect the admin side of a WordPress site like this one: 我见过一些教过如何保护WordPress网站管理员端的网站,例如:

http://www.wpbeginner.com/wp-tutorials/9-most-useful-htaccess-tricks-for-wordpress/ http://www.wpbeginner.com/wp-tutorials/9-most-useful-htaccess-tricks-for-wordpress/

But how about the entire site from the homepage itself? 但是,整个网页本身又如何呢?

Just follow the link that you posted and put this in the htaccess file in your document root: 只要按照您发布的链接并将其放在文档根目录下的htaccess文件中即可:

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "WordPress Admin Access Control"
AuthType Basic
Require valid-user

except replacing the AuthUserFile with the path of the htpasswd file that you generated. 除了将AuthUserFile替换为所生成的htpasswd文件的路径。

That's all. 就这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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