How to direct visitor 'Coming Soon' page based on there IP?

2 replies
  • WEB DESIGN
  • |
Hey Warriors,

Im setting up a new site for a client and only want them and myself to see the site in process.

All others will be directed to a 'Coming Soon' page.

The code will look for my IP and my clients IP....if they match....we see the new site.

If not, the go to: newwebsite.net/coming-soon

Thanks for the insight on this!

Bret
#based #coming #direct #page #visitor
  • Profile picture of the author GowebMkt
    I found an htaccess code snippet here:

    # MAINTENANCE-PAGE REDIRECT
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^84\.83\.32\.232
    RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
    RewriteCond %{REQUEST_URI} !/coming-soon$ [NC]
    RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
    RewriteRule .* /coming-soon [R=302,L]
    </IfModule>

    I have it set so it does not know my IP.

    But, when I go to the new site it redirects me with this error on the page:

    The targetsolutionsusa.com page isn’t working

    targetsolutionsusa.com redirected you too many times.
    ERR_TOO_MANY_REDIRECTS

    Any ideas?
    {{ DiscussionBoard.errors[10637669].message }}
  • Profile picture of the author GowebMkt
    I was able to find some PHP code.....simply add this to the very top of your header code or index.php page.

    Simply put the IPs you want to have access to the site below...all other will see the 'coming soon' page.


    <?php if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '57.83.32.2')))
    {
    header('Location: http://www.targetsolutionsusa.com/coming-soon');
    exit;
    }
    ?>
    {{ DiscussionBoard.errors[10637691].message }}

Trending Topics