简体   繁体   中英

How to protect sub folder via .htaccess file in wordpress site

I want to set permission to access my beta site, but I got "Page not found" error, below is my code, how can I fix this error?

AuthUserFile /home3/mysitename/public_html/beta/.htpasswd
AuthName EnterPassword
AuthType Basic
<Limit GET POST>
require valid-user

Most rules that are in htaccess files have precedence in subfolders first. Meaning a htaccess file in your /beta/ folder will completely supercedes any rules in a parent directories.

So if you need to protect only the subfolder and not the main folder place the htaccess (or the part with the password section) in the folder you wish to protect.

By the way a better idea might be to use a subdomain for that construct.

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