Skip to content

Instantly share code, notes, and snippets.

@travismillerweb
Created July 3, 2012 16:53
Show Gist options
  • Save travismillerweb/3040983 to your computer and use it in GitHub Desktop.
Save travismillerweb/3040983 to your computer and use it in GitHub Desktop.
PHP - Index/Follow Script
<?php
//[TM][6/19/2012] Index-Follow Script
// Another variation of the URL_task script. This one is based on SEO Requirements of redundant pages created by WordPress loops.
//v1.0.0
$domain = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$homepage = "www.[domain].com/";
$reg_meta = "<meta name='robots' content='index, follow' />";
if ($domain <> $homepage)
{
$tag = strpos($domain, "tag/");
$category = strpos($domain, "category/");
$page = strpos($domain, "page/");
$all = strpos($domain, "/");
if ($tag == true) {$index_follow = "<meta name='robots' content='noindex, nofollow' />";}
elseif ($category == true) {$index_follow = "<meta name='robots' content='noindex, nofollow' />";}
elseif ($page == true) {$index_follow = "<meta name='robots' content='follow, noindex' />";}
elseif ($page == true) {$index_follow = $reg_meta;}
echo ($index_follow);
}
else
{
echo ($reg_meta);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment