Basic Auth for WordPress

I assume you have shell access to your wordpress installtion here.

Go to your wordpress directory and enter: (use your own name)

htpasswd -c .htpasswd klaus

Enter your password twice and then run:

pwd

Copy the printed directory into your clipboard and replace “your directory here” from the following lines with your path.

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile <your directory here!>/.htpasswd
Require valid-user

Now open .htaccess with your preferred editor like vim and copy/paste the above lines before it says # BEGIN WordPress

You’re done.

Flattr this!

Bookmark the permalink.

Leave a Reply