How To Do htaccess Based Cloaking?

Discussion in 'Apache' started by T0PS3O, Jan 18, 2007.

  1. #1
    I have a domain that redirects all trafic to an existing site. Now I need to start developing it. I want to keep it redirecting like it does now:

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)$ http://www.otherdomain.com/ [R=301,L]
    Code (markup):
    But my own IP should be excluded form this.

    How would I go about adding such an 'if statement'?

    
    if IP != 123.456.78
    {
    RewriteRule ^(.*)$ http://www.otherdomain.com/ [R=301,L]
    }
    
    Code (markup):
    Is that possible at all?
     
    T0PS3O, Jan 18, 2007 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Answering myself for future reference:

    
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REMOTE_ADDR} !^123.456.78.90
    RewriteRule ^(.*)$ http://www.otherdomain.com/ [R=301,L]
    
    Code (markup):
    The ! will cause all IPs that are NOT the one written there to be redirected, keeping myself in that folder.

    Thanks for tuning in to todays useless monologue!
     
    T0PS3O, Jan 18, 2007 IP
    Clive likes this.
  3. Foxy

    Foxy Chief Natural Foodie

    Messages:
    1,614
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hehehe

    Hi tops - I just did for the first time in yonks.

    Happy New year...
     
    Foxy, Jan 18, 2007 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks Foxy, you too have a smashing 2007!

    Note to self: DO NOT FORGET TO UNCLOAK IT AND WONDER WHY IT GETS NO TRAFFIC!
     
    T0PS3O, Jan 18, 2007 IP
    Mia likes this.