I'm trying to secure a login area so as to allow whitelist users access, but redirect everyone else to the root of the site. Here is what I've got thus far, but it doesn't work (IPs are just examples):
- Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^192\.100 [OR]
RewriteCond %{REMOTE_HOST} !^192\.200
RewriteRule ^admin/$ / [L]
The idea is to re-use this same htaccess file for numerous sites, so if it is possible, I would like to redirect unwanted visitors to the site root (/) rather than having to write the absolute path (http://www.mywebsite.com) for each website.
Your help would be much appreciated.
Thanks.