Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Last active July 19, 2018 10:12
Show Gist options
  • Save niraj-shah/ac808ab6dbf4002490b845d79c170304 to your computer and use it in GitHub Desktop.
Save niraj-shah/ac808ab6dbf4002490b845d79c170304 to your computer and use it in GitHub Desktop.
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