ErrorDocument 403 /index.html
DirectoryIndex index.html
<Files ~ "index\.html">
Order Allow,Deny
Allow from all
</Files>
Deny from all
Content of your .htaccess file
If you want to whitelist any IP, use this
ErrorDocument 403 /index.html
DirectoryIndex index.html
<Files ~ "index\.html">
Order Allow,Deny
Allow from all
</Files>
Order Allow,Deny
Allow from xx.xxx.xx.xx
Deny from all
Here is a sample htaccess for a wordpress website with 1 IP whitelisted 4.129.45.44 and all others are banned. So you only will be able to load the website while everyone else will see contents of index.html with HTTP Status code 403
ErrorDocument 403 /index.html
DirectoryIndex index.php
<Files ~ "index\.html">
Order Allow,Deny
Allow from all
</Files>
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^4\.129\.45\.44$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REMOTE_ADDR} !^4\.129\.45\.44$
RewriteRule . /index.php [L]
Allow from 4.129.45.44
Deny from all
Leave a Reply