If you are just wanting a simple “login” you could use htpasswd
and htaccess
. WordPress sites already have the htaccess
in the main directory.
Add an .htpasswd
file at the same level as your root HTML folder. Example:
.
├── public_html
| └── wordpress
| └── .htaccess
└── .htpasswd
Use a tool like htpasswd generator to generate a username/password pair. Then add this to your .htpasswd
file.
Find the path $_SERVER["DOCUMENT_ROOT"]
may provide some insight for you.
Edit WP’s .htaccess
. After the #END WORDPRESS#
add
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /var/www/mysite/.htpasswd
require valid-user
If you need more detailed instructions see this post.
However, this does not address your request about IP Validation. This question on StackOverflow may address it.
You would update the .htaccess
file to read
AuthUserFile /var/www/mysite/.htpasswd
AuthName "Please Log In"
AuthType Basic
require valid-user
Order allow,deny
Allow from xxx.xxx.xxx.xxx
satisfy any