I recently developed an internal website for one company that requires to be accessible to employees only. I decided to just limit access to by IP address. This way everyone on the office network could access easily, but outside the network they would get an access denied message.

I use WP Engine for hosting, but IP whitelisting or blocking should work with any host.
.htaccess Option

One quick method to set this up is by editing the .htaccess file directly (this should be in the base folder of your WordPress directory) and add the 3 lines at the top of this codeblock:

order deny,allow
deny from all
allow from 91.5.000.000

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

You’ll want to change the IP address in the example (91.5.000.000) to the IP you want to whitelist. You can also whitelist multiple IP addresses by just adding more below that line.

There are currently no comments.