Reputation: 127
I would like to redirect some specific IP addresses to a different page when they access my home page using htaccess. There are 3 IP address that I want to redirect. I would like to redirect to a URL like:
www.domain.com/ --> www.domain.com/?redirect=1
How do I do this?
Upvotes: 1
Views: 2107
Reputation: 785128
You can use this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} ^(11\.22\.33\.44|21\.22\.23\.24|33\.32\.33\.34)$
RewriteRule ^/?$ /?redirect=1 [L,R=302]
Replace these IPs with your actual IP.
Upvotes: 2