Skip to content

Instantly share code, notes, and snippets.

@chiplay
Created May 20, 2013 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiplay/5614595 to your computer and use it in GitHub Desktop.
Save chiplay/5614595 to your computer and use it in GitHub Desktop.
preg_match('/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex|^$/i', $_SERVER['HTTP_USER_AGENT'], $matches);
if (!$matches) {
$_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $_SERVER['REQUEST_URI_PATH']);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment