Reputation: 3
i need .htaccess code to redirect and ban ip's ,i mean if i try to load www.site.com with 123.456.789.101 ip address allow me, but if someone else try to load ,redirect them to other subdomain like sub.site.com , i write below code but dont work correctly.
<Limit GET POST PUT> Order Deny,Allow
Deny from all
Allow from 123.456.789.101
</Limit>
301 redirect / http://new.site.com
<Files otherpage.html>
Order Allow,Deny
Allow from all
</Files>
please help , Tank You
Upvotes: 0
Views: 255
Reputation: 143856
Replace your Limit
block and 301 redirect
with this:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.101$
RewriteRule ^(.*)$ http://new.site.com/$1 [L,R=301]
So that it's above your Files
block (though I'm not sure why you'd need that)
Upvotes: 1