Add a full site authentication function to the website

» Toss and turn » Add a full site authentication function to the website

By adding some passwords to the website, we can prevent some unwelcome people from visiting their own website and increase the security of the website content




Add the following code to wp-config.php of WordPress to encrypt the whole site. Or, you can put it on the wp-login.php page, and you can log in to the page for encryption
 define('XXOO_ USERNAME','Username'); // Login name, self modification define('XXOO_ PASSWORD','Password'); // Login password, self modification if (! isset($_ SERVER['PHP_ AUTH_ USER']) || ! isset($_ SERVER['PHP_ AUTH_ PW']) || $_ SERVER['PHP_ AUTH_ USER'] !=  XXOO_ USERNAME ||$_ SERVER['PHP_ AUTH_ PW'] !=  XXOO_ PASSWORD) { Header("WWW-Authenticate: Basic realm=\"Website Login\""); Header("HTTP/1.0 401 Unauthorized"); echo <<<EOB <html><body> <h1>Rejected!</ h1> <big>Wrong Username or Password!</ big> </body></html> EOB; exit; }

Directly replace the name and password in the code给网站增加一个全站身份验证功能-极客公园


Recently, I was doing a page to detect the user's login status, cookie information and payment information, so I thought of this.

  • Why is it that the later you are recently, the more energetic...



Your email address will not be disclosed. Required item used * tagging

2 replies to "add a full site authentication function to the website"