Ryder Cragie
Ryder Cragie

Reputation: 165

Redirect an IP Address with .htaccess

I use LiteSpeed and I’m wondering what code I need to add to my .htaccess file to redirect certain IP addresses to another link/website. Thanks!

Upvotes: 1

Views: 415

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

Something like the following :

RewriteEngine On

RewriteCond %{REMOTE_ADDR} ^1\.2\.3\.4\.5$
RewriteRule ^ https://example.com [L,R]

This redirects the client with ip address 1.2.3.4.5 to example.com.

Upvotes: 1

Related Questions