1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting sued : need to redirect bots to new domain but user must see a blank page, how to?

Discussion in 'Cloaking and Content Generators' started by djprog, Apr 6, 2011.

  1. djprog

    djprog Registered Member

    Joined:
    Mar 20, 2010
    Messages:
    99
    Likes Received:
    42
    Location:
    where there is snow, ocean, wind or all 3
    Hello Guys,

    Well it looks like i'm about to finally get sued...:eek: even if i'm right...

    Long story short : i need to get a new domain and the old one must look as if it was no longer in use. But ideally the link juice should follow...

    Is there a way (PHP or htaccess or whatever works) to :
    - Tell the bots I moved to the new domain (so the link juice is passed)
    - Display a blank page to the users (so the other bastard will think i have removed the site)

    ???

    Thanks for your help,

    Cheers,
     
  2. bullseye123

    bullseye123 Regular Member

    Joined:
    May 4, 2010
    Messages:
    287
    Likes Received:
    126
    Occupation:
    IT Support
    Location:
    South Africa
    The only way to get keep the link juice will be to in some way use a 303 Re-Direct.

    In showing a Blank Page, this is not going to be possible if you want to keep the Link Juice.

    It is not going to be easy, Im afraid that you might loose all the SEO that you have done on that website.

    I suggest Moving your registrar abroad then there might not be any problems with the People Suing you. Move everything to another country .

    If you know somebody in another country that you trust, Put everything on their name.

    Think you should be fine after that.
     
  3. djprog

    djprog Registered Member

    Joined:
    Mar 20, 2010
    Messages:
    99
    Likes Received:
    42
    Location:
    where there is snow, ocean, wind or all 3
    Thank you for the reply.

    I'm EU based an my registrar is namecheap and hosting is somewhere in finland i think.

    I've heard namecheap was strict and not giving away personnal data unless a court order is issued.
     
  4. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    bullseye you mean a 301 redirect :)

    You could use a simple user agent cloak, something like:

    PHP:
    <?php

    if(preg_match('/google|slurp|msnbot|otherbotnames/i'$_SERVER['HTTP_USER_AGENT'])) {
        
    // Show 301 redirect to bots
        
    header('Location: http://www.yournewdomain/');
        exit;
    } else {
        
    // Show a blank page
        
    exit;
    }

    ?>
     
    • Thanks Thanks x 5
  5. bullseye123

    bullseye123 Regular Member

    Joined:
    May 4, 2010
    Messages:
    287
    Likes Received:
    126
    Occupation:
    IT Support
    Location:
    South Africa
    Thanks Autumn, that little script is handy.

    There you have it OP.

     
  6. djprog

    djprog Registered Member

    Joined:
    Mar 20, 2010
    Messages:
    99
    Likes Received:
    42
    Location:
    where there is snow, ocean, wind or all 3
    Thank you Autumn, REP added, I think i'll use this and in the meantime put this domain in forced redemption period (so it will delete in 30 days).

    Do you know where i can get a full list of bots user-agent ???

     
  7. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    I improved the script a little. Now the list of SE bot strings is separated out for ease of editing and I added the main bots in there. You can also fill in your new domain easily at the top and the script will automatically do a 301 redirect on a page by page basis to the appropriate page on your new domain - so all of your backlinks should be credited to the right page on your new domain.

    You can find more SE spiders by just googling around for stuff like "list of search engine user agents 2011" although most of the lists are kind of shitty and out of date. Google and Bing are the main ones to worry about though and they should already be taken care of by this script.

    I'd be slightly hesitant to force expiry too fast because you want to make sure every page on your old site gets spidered at least once so that the 301 redirects get picked up and all the pages on your new domain get credited with your existing backlinks.

    PHP:
    <?php

    // Autumn's don't-get-sued redirect script v0.1

    // Your new domain eg www.newdomain.com
    $new_domain 'www.newdomain.com';

    // List of SE spider user agents
    // Doesn't have to be the whole user agent, just a string that we can match
    $se_spiders = array(
        
    'googlebot',
        
    'slurp',
        
    'msnbot',
        
    'baidu',
        
    'bing',
        
    'ia_archiver'// alexa
        
    'yandex'
    );


    /******************************************************************************/
    // Don't edit below here

    // Work out what new location will be
    $new_location "http://$new_domain"$_SERVER['REQUEST_URI'];

    // Implode SE spider list for regex matching
    $se_spiders implode('|'$se_spiders);

    if(
    preg_match("/$se_spiders/i"$_SERVER['HTTP_USER_AGENT'])) 
        
    // Show 301 redirect to bots
        
    header("Location: $new_location");
        exit;
    } else {
        
    // Show a blank page
        
    echo $new_location .'<br>'$_SERVER['HTTP_USER_AGENT'];
        exit;
    }

    ?>
    Probably the easiest way to use this would be to save it as redirect.php (or whatever filename you like) in the root directory of your domain. Work out the absolute path to the directory that your domain is in, and then you can just include it in every page by inserting one line before the opening <html> tag on every page of your site. For example, if the absolute path to your domain on the server was /var/www/djprog/olddomain.com, you would insert this line before each opening <html> tag on all of your pages:

    PHP:
    <?php include('/var/www/djprog/olddomain.com/redirect.php'); ?>
    If you have a friendly host, you could probably get them to add this code to each page of your site with a simple sed script.

    Thanks for the rep!
     
    • Thanks Thanks x 3
  8. djprog

    djprog Registered Member

    Joined:
    Mar 20, 2010
    Messages:
    99
    Likes Received:
    42
    Location:
    where there is snow, ocean, wind or all 3
    Thanks the "Autumn's dont-get-sued redirect script" looks awesome.

    Just a last question. I'm using wordpress. So for all the pages can you confirm that the redirect will be called by simply changing the header.php function from (assuming I change it to the right path) :

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />
    <title><?php wp_title( '|', true, 'right' ); bloginfo( 'name' ); ?></title>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url') ?>" type="text/css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style.ie7.css" type="text/css" media="screen" /><![endif]-->
    <?php if(WP_VERSION < 3.0): ?>
    <link rel="alternate" type="application/rss+xml" title="<?php printf(__('%s RSS Feed', THEME_NS), get_bloginfo('name')); ?>" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php printf(__('%s Atom Feed', THEME_NS), get_bloginfo('name')); ?>" href="<?php bloginfo('atom_url'); ?>" />
    <?php endif; ?>
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php if (is_file(TEMPLATEPATH .'/favicon.ico')):?>
    <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
    <?php endif; ?>
    <?php wp_head(); ?>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/script.js"></script>
    </head>
    <body <?php if(function_exists('body_class')) body_class(); ?>>
    <?php 
    ob_start();
    to :

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    [COLOR=Lime][B]<?php include('/var/www/djprog/olddomain.com/redirect.php'); ?>[/B][/COLOR]
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />
    <title><?php wp_title( '|', true, 'right' ); bloginfo( 'name' ); ?></title>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url') ?>" type="text/css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style.ie7.css" type="text/css" media="screen" /><![endif]-->
    <?php if(WP_VERSION < 3.0): ?>
    <link rel="alternate" type="application/rss+xml" title="<?php printf(__('%s RSS Feed', THEME_NS), get_bloginfo('name')); ?>" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php printf(__('%s Atom Feed', THEME_NS), get_bloginfo('name')); ?>" href="<?php bloginfo('atom_url'); ?>" />
    <?php endif; ?>
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php if (is_file(TEMPLATEPATH .'/favicon.ico')):?>
    <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
    <?php endif; ?>
    <?php wp_head(); ?>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/script.js"></script>
    </head>
    <body <?php if(function_exists('body_class')) body_class(); ?>>
    <?php 
    ob_start();
    Thank you !

    Cheers,
     
  9. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    Actually you need to put the php include statement before the doctype ie.

    Code:
    <?php include('/var/www/djprog/olddomain.com/redirect.php'); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    I had forgotten about the doctype tag. You have to issue the redirect before you've sent any html to the browser. Just make the include the very first thing in each WP page.
     
    • Thanks Thanks x 2
  10. djprog

    djprog Registered Member

    Joined:
    Mar 20, 2010
    Messages:
    99
    Likes Received:
    42
    Location:
    where there is snow, ocean, wind or all 3
    Thanks again for all the help. I'll let you know if it works like it should (i'll move everything this afternoon).

    Cheers,
     
  11. djprog

    djprog Registered Member

    Joined:
    Mar 20, 2010
    Messages:
    99
    Likes Received:
    42
    Location:
    where there is snow, ocean, wind or all 3
    Yeeeeepeeeee it's working like a charm. :banana:

    I've only made a few changes :
    - added a { at the beginning of the if or you get a syntax error
    - changed the redirection to 301 instead of 302
    - display a nice looking 404 to the browser / users

    Now I guess I just have to wait to see if big G likes my new site as he liked the old one.

    1000 thanks to Autumn for his help !!!

    Code:
    <?php
    
    // Autumn's redirect script v0.1
    // edited by djprog script v0.2 : display 301 instead of 302 redirection + display 404 to browser
    
    // Your new domain eg www.newdomain.com
    $new_domain = 'newdomain.com';
    
    // List of SE spider user agents
    // Doesn't have to be the whole user agent, just a string that we can match
    $se_spiders = array(
        'googlebot',
        'slurp',
        'msnbot',
        'baidu',
        'bing',
        'ia_archiver', // alexa
        'yandex'
    );
    
    
    /******************************************************************************/
    // Don't edit below here
    
    // Work out what new location will be
    $new_location = "http://$new_domain". $_SERVER['REQUEST_URI'];
    
    // Implode SE spider list for regex matching
    $se_spiders = implode('|', $se_spiders);
    
    if(preg_match("/$se_spiders/i", $_SERVER['HTTP_USER_AGENT'])) {
        // Show 301 redirect to bots
        header("HTTP/1.1 301 Moved Permanently");
        header("Location: $new_location");
        exit;
    } else {
        // Show a 404 page to browser
        //echo $new_location .'<br>'. $_SERVER['HTTP_USER_AGENT'];
        echo '<html>
    <head><title> 404 Not Found
    </title></head>
    <body><h1> 404 Not Found
    </h1>
    The resource requested could not be found on this server!<hr />
    </body></html>';
        exit;
    }
    
    ?> 
     
    • Thanks Thanks x 2
  12. dannyhw

    dannyhw Senior Member

    Joined:
    Jul 16, 2008
    Messages:
    980
    Likes Received:
    463
    Occupation:
    Software Engineer
    Location:
    New York City Burbs
    Sued? What for?
     
  13. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    Argh sorry about the bugs djprog. Here's a final version for anyone who's interested with slightly cleaner formatting. I moved the error page html up top so all the user editable stuff is all together.

    PHP:
    <?php

    // Autumn's redirect script v0.1
    // edited by djprog script v0.2 : display 301 instead of 302 redirection + display 404 to browser
    // v0.2.1 formatting

    // See: http://www.blackhatworld.com/blackhat-seo/cloaking-content-generators/295443-getting-sued-need-redirect-bots-new-domain-but-user-must-see-blank-page-how.html

    // Your new domain eg www.newdomain.com
    $new_domain 'newdomain.com';

    // List of SE spider user agents
    // Doesn't have to be the whole user agent, just a string that we can match
    $se_spiders = array(
        
    'googlebot',
        
    'slurp',
        
    'msnbot',
        
    'baidu',
        
    'bing',
        
    'ia_archiver'// alexa
        
    'yandex'
    );

    // HTML to show the surfer
    $surfer_html '<html>
    <head>
    <title>404 Not Found</title>
    </head>
    <body>
    <h1>404 Not Found</h1>
    The resource requested could not be found on this server<hr />
    </body>
    </html>
    '
    ;



    /******************************************************************************/
    // Don't edit below here

    // Work out what new location will be
    $new_location "http://$new_domain"$_SERVER['REQUEST_URI'];

    // Implode SE spider list for regex matching
    $se_spiders implode('|'$se_spiders);

    if(
    preg_match("/$se_spiders/i"$_SERVER['HTTP_USER_AGENT'])) {
        
    // Show 301 redirect to bots
        
    header("HTTP/1.1 301 Moved Permanently");
        
    header("Location: $new_location");
        exit;
    } else {
        
    // Show a 404 page to browser
        
    echo "$surfer_html\n";
        exit;
    }

    ?>
     
  14. CyberknightTully

    CyberknightTully Junior Member Premium Member

    Joined:
    Feb 19, 2010
    Messages:
    136
    Likes Received:
    148
    Occupation:
    "Retired" and TIRED of it! Going to work for ME!
    Location:
    The Superstition Mountains Looking For The Lost Du
    Your hosting is "somewhere in Finland I think"? You should probably figure out that one right off the bat! Namecheap will not divulge personal info with a court order from a court in the USA. Also the real threat to you is built around where you are being sued. You're EU based so if they sue you in the USA you can tell them to fuck off and likely get away with it.
     
  15. myniche

    myniche Junior Member

    Joined:
    Feb 13, 2009
    Messages:
    112
    Likes Received:
    51
    Good work Autumn!

    Be careful. International lawsuits can be filed. If they have a serious claim, they can find you and sue you through your country's legal system.

    Just evaluate the damage done and take appropriate steps as you are doing.
     
  16. GivingBack

    GivingBack Newbie

    Joined:
    Apr 6, 2011
    Messages:
    13
    Likes Received:
    1
    Offshore domains ftw! But they're pricy. Although 50USD is still cheaper than a big fat lawsuit.
     
  17. osearth

    osearth Newbie

    Joined:
    Apr 20, 2011
    Messages:
    5
    Likes Received:
    0
    Occupation:
    Freelance
    Location:
    Canada
    Home Page:
    Either very easy or impossible.

    The REFERER or USERAGENT will be specific to the bots. Just DIE if its not a bot.

    There may also be a way using javascript to stall the browser or atleast show a blank page if it's a proper browser client.

    You need sample HTTP GETs from the bots and from normal users then you can compare them. Humans quite often overlook small things like spacing, formatting missing headers, wonky URI layout when they try to mimic automated software..
     
  18. popzzz

    popzzz Supreme Member

    Joined:
    Apr 12, 2009
    Messages:
    1,337
    Likes Received:
    13,704
    Location:
    Don't touch the REP!
    Yes but namecheap answers to enom which is in the USA.

    Tread lightly if in USA. :thumb:

    Enjoy ..... :cool2:


     
  19. friedman

    friedman Registered Member

    Joined:
    Apr 15, 2011
    Messages:
    70
    Likes Received:
    9
    that script will get you completely de-indexed from google, quickly?

    it completely violates the TOS from big G

    Very easy for them to detect this with automation.

    They will send a bot posing as a fake "visitor" to your site, see the blank page, compare that to what is being presented to the indexbot. Then, a nice de-indexing...
     
  20. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    This was a quick short term solution for a specific problem and by all accounts it worked well. For long term cloaking a more robust mosaic solution is required but from what I understand this worked out for the OP. It's not designed as a cloaking script for long term use... Any idiot can see that.

    I could also show you dozens of sites that last in the serps using user agent cloaking alone - it all depends on your niche, your competition and how well you can fly under the radar with your backlinking techniques.

    Also, you are much less likely to get busted if all you're doing is serving a 301 to a new copy of the original site.

    [​IMG]