- Sep 15, 2010
- 511
- 180
.htaccess
r.php:
short links:
p.s.: this is created by myself it works great if you can manage to set it up (it's very easy to setup though)
Code:
RewriteEngine On
RewriteRule ^r\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^r/(.*)$ /r.php [L]
r.php:
Code:
<?php
$bingurl = "http://url-to-send-the-bing-bot.com";
// in my experience you can even get some urls indexed in bing if you spam hard enough
// url where the real people will be sent ( most bots don't follow meta redirect )
$humanurl = "http://url-for-real-people.com";
$a = $_SERVER['HTTP_USER_AGENT'];
if(!stristr($_SERVER['HTTP_USER_AGENT'] , "bing"))
{
if
(
$a == '' || // empty user agent
stristr($a , "bot") || // user agent contains bot
stristr($a , "butterfly") || // user agent contains butterfly
stristr($a , "MFE") || // user agent contains mfe
stristr($a , "voyager") || // user agent contains voyager
stristr($a , "UnwindFetchor") || // user agent contains UnwindFetchor
stristr($a , "postrank") || // user agent contains postrank
stristr($a , "metauri") // user agent contains metauri
)
{
if(!stristr($_SERVER['HTTP_USER_AGENT'] , "Twitterbot")) // user agent does not contain twitterbot
{
//remove the next 3 lines if you don't want to see the detected bots
$fh = @fopen("log.txt" , "a");
@fwrite($fh , "BOT: " . $_SERVER['HTTP_USER_AGENT']. "\n");
@fclose ($fh);
}
header("Location: http://www.google.com");
die();
}
}
if(stristr($_SERVER['HTTP_USER_AGENT'] , "bing"))
{
if( $bingurl != "" )
header("Location: " . $bingurl);
else
header("Location: " . $humanurl);
die();
}
?>
<html>
<head><title>Loading... please wait!</title></head>
<body>
Loading... please wait!
<meta http-equiv="refresh" content="0;url=<?=$humanurl?>" />
</body>
</html>
short links:
Code:
your domain is: example.com
r.php is at: http://example.com/r.php
valid links: http://example.com/r/ANY-RANDOM-STUFF
so bitly -> http://example.com/r/dg76GAJSFa -> your link
p.s.: this is created by myself it works great if you can manage to set it up (it's very easy to setup though)
Last edited: