Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect based on IP address

Status
Not open for further replies.

robdon

Programmer
May 21, 2001
252
ES
Hi,

I know how to block a certain IP, with .htaccess and I also know how to redirect pages.

How can I redirect all attempts to access my site to another site... Based on an IP address.

Is this possible? A line in .htaccess?

Thanks,

Rob Donovan.
 
It can be done. You'll need to use mod_rewrite to do it.

Something along the lines of:

RewriteEngine on
RewriteCond %{REMOTE_ADDR} <match IP>
RewriteRule .* [R]

Will issue a redirect to anyone matching <match IP> to the site of your choice.

Check for more information. ______________________________________________________________________
Never forget that we are
made of the stuff of stars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top