Create Password Protect Admin.php - Xenforo 2

Create Password Protect Admin.php - Xenforo 2


You can increase the security of Admin Xenforo by creating an extra password to access the admin.php file, using .htaccess and .htpasswd

Step One: Edit .htaccess

Add the following lines to the .htaccess file, at the root directory (containing the admin.php file).

You must be logged-in to view.
(6 lines)

Change /path/to/public/.htpasswd according to the configuration on your server.

Step Two: Create .htpasswd
Create a new .htpasswd file in the root directory.
Visit the website:
Enter the username and password used to access the admin.php file. Then click Create .htpasswd file
Then you will get a piece of code that looks like: username:{SHA}abcxyzxxxx
Copy that code and paste it into the .htpasswd file.


That's It! When you visit the file through your browser, you'll now be prompted for a username and password.

Last edited by a moderator:
Top Bottom