Instantly share code, notes, and snippets.

@niraj-shah /htaccess
Last active Jul 19, 2018

Embed
What would you like to do?
WordPress .htaccess Restrictions
# .htaccess file for root WordPress directory
# add this line if it's not already present in your .htaccess file
ErrorDocument 401 default
<Files "wp-login.php">
AuthName "WordPress Admin"
AuthUserFile "/path/to/passwd"
AuthType Basic
require valid-user
</Files>
# .htaccess file for wp-admin directory
# add this line if it's not already present in your .htaccess file
ErrorDocument 401 default
AuthName "WordPress Admin"
AuthUserFile "/path/to/passwd"
AuthType Basic
require valid-user
# allow anyone to access to admin-ajax.php
<Files "admin-ajax.php">
Allow from all
Satisfy Any
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment