Redirect an IP Address with .htaccess

Viewed 83

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!

1 Answers

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.

Related