简体   繁体   中英

How to authenticate users to my site?

I simply want people to authenticate themselves when typing in my website URL. For example, I saw an article on 10/20/14 that said that FX was coming out with a website for the Simpsons called 'simpsonsworld.com' so I visited the site (to check it out). However, later in the article it said that the site was not becoming live until 10/21/14 (today). When I typed in 'simpsonsworld.com' into the URL, a dropdown box asked me to authenticate myself (username & password). When you visit the site today (10/21), the site is completely visible.

How do I get this drop-down box when someone types in 'myurl.com'?

Thank you!

Use .htaccess and .htpassword . From http://davidwalsh.name/password-protect-directory-using-htaccess

.htaccess should contain

AuthType Basic
AuthName "restricted area"
AuthUserFile /the/path/youre/protecting/.htpasswd
require valid-user

.htpasswd should contain

username:password

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