1. Home
  2. Knowledge Base
  3. Website
  4. Website Tips
  5. How to redirect all visitors except your IP to another website

How to redirect all visitors except your IP to another website

In order to redirect everyone to another website, you should add this code to your .htaccess file:

+++++++
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteRule .* http://www.anothersite.com [R=302,L]
++++++

You can create/edit the .htaccess file using File Manager in cPanel, but make sure to replace the numbers 1.2.3.4 with your actual IP address. You can find what your IP address is at:

https://whatismyip.com/

This will redirect all your visitors to http://www.anothersite.com except you.

Related Articles