homepage Welcome to WebmasterWorld Guest from 54.237.78.165
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Marketing and Biz Dev / Cloaking
Forum Library, Charter, Moderator: open

Cloaking Forum

    
Redirect - Need help!
How can I modify this so spiders that come to this url stay at my site...
unseen

5+ Year Member



 
Msg#: 3049951 posted 2:09 pm on Aug 17, 2006 (gmt 0)

Hi,
I'm getting traffic to an "site/url" that I need redirect to another site, I have been using this code for that:

<?php
header("Location: [?.com");...]
exit;
?>

How can I modify this so spiders that come to this url stay at my site and crawl it instead of following to?.com?

P.S the answer to this dosn't have to be php.. just work ;)

 

volatilegx

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3049951 posted 2:23 pm on Aug 17, 2006 (gmt 0)

To accomplish what you want to do, write or use a cloaking script. Here is some psuedo code:

<?php
// Do a database lookup to see if the visitor's
// IP address is in your database of search engine
// spiders.
$query = "SELECT IP FROM SPIDERS WHERE IP = '".addslashes($REMOTE_ADDR;)."' LIMIT 1";
$result = mysql_query($query);
$spider = mysql_num_rows($result);
if (!$spider){
// no match is found, so the visitor is a human
// do the redirect
header("Location: [whatever.com...]
exit;
}

// A match was found in the database, which means
// the visitor is a search engine spider.
// Continue to display the rest of the page.

?>

There are ready-made solutions available for this if you don't feel like coding your own.

rankboy

10+ Year Member



 
Msg#: 3049951 posted 7:37 pm on Sep 5, 2006 (gmt 0)

>> $query = "SELECT IP FROM SPIDERS WHERE IP = '".addslashes($REMOTE_ADDR;)."' LIMIT 1";

Rather than addslashes() I always like using mysql_escape_string() I think addslashes has been deprecated. They both do the same thing though :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Marketing and Biz Dev / Cloaking
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved