I'm trying to only allow specific IP ranges to access /user/login. Denying anything under the /user sub-directory would suffice.
So far I've tried:
<Location /user>
Order deny,allow
Deny from all
Allow from 123.45.116.0/24
Allow from 123.225.232.0/23
Allow from 123.225.114.0/23
Allow from 123.9.53
</Location>
and
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.45\.116\.0/24$
RewriteCond %{REMOTE_ADDR} !^123\.225\.232\.0/23$
RewriteCond %{REMOTE_ADDR} !^123\.225\.114\.0/23$
RewriteCond %{REMOTE_ADDR} !^123\.9\.534$
RewriteRule ^user/? - [F,NC]
and
RewriteCond %{HTTP:X-FORWARDED-FOR} !^123\.45\.116\.0/24
RewriteCond %{HTTP:X-FORWARDED-FOR} !^123\.225\.232\.0/23
RewriteCond %{HTTP:X-FORWARDED-FOR} !^123\.225\.114\.0/23
RewriteCond %{HTTP:X-FORWARDED-FOR} !^123\.9\.53\.
RewriteRule ^(user|user/login) - [F]
no luck. Could anyone out there please help? I always struggle with htaccess.