Get 15% Off! Use Coupon: GlowUp-15

The deal ends in

How to Redirect all Visitors Except One IP to Another Website

  • Home
  • cPanel
  • How to Redirect all Visitors Except One IP to Another Website

Sometimes you may need to redirect all web traffic to another website or another page within your site but you still want to be able to view your website. This is common when you are making changes that you are not ready for others to see just yet or when you are performing maintenance. In this article, we will discuss How to Redirect all Visitors Except One IP to Another Website.

In this Guide:  Take me to the .htaccess Code

You can achieve this in a few simple steps using the .htaccess file which is located in the document root of your website. To edit your .htaccess file, you will need to access File Manager in your cPanel account.

How to Redirect all Visitors Except One IP to Another Website

Edit Your .htaccess file via File Manager:

1. Log into cPanel

2. Click on ‘File Manager

3. Navigate to the document root for your website.

4. Locate the ‘.htaccess‘ file in the list. Click once on the file to highlight it, then right click on the file and select ‘edit‘.

How to Redirect all Visitors Except One IP to Another Website

Click on ‘Edit‘ again in the prompt to open the file for editing.

How to Redirect all Visitors Except One IP to Another Website

Note! .htaccess is considered a dot file. In File Manager, dot files are hidden by default. You will need to “unhide” them in the settings in file manager to see your .htaccess file.

→ Click Here to Learn How to Show Hidden (dot) files in File Manager

5. With the .htaccess file open in the editor, paste the following code into the next line in the file:

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

In the code above:

Example:

How to Redirect all Visitors Except One IP to Another Website

6. Click ‘Save‘ to save your changes!

That’s it! You should be able to browse to your website from your IP address but all other visitors should be redirected to the URL you specify.

GlowFrog (1)

© 2022 GlowFrog Hosting, LLC. All rights reserved. | Proudly Powered by Vultr and Google Cloud

Get Notified.

Provide us with your email and we will keep you informed with latest updates and news.

Migrate Your WordPress Site to GlowFrog

Need Help Optimizing your WordPress Site?

Talk to our Experts and get a complimentary website review and consultation.