Page 1 of 1

noindex meta element via PHP on any page with HTTP query?

Posted: Mon Dec 10, 2007 2:13 am
by JAB Creations
I want my site to play nice with search engines and thus I don't want search engines to recrawl the same pages with HTTP queries. So what would be a nice clean way to determine if the page was loaded with any HTTP query so I can simply echo a meta noindex element?

Here is an attempt that didn't work...

Code: Select all

$thisurl = $_SERVER['REQUEST_URI'];
 if (preg_match("/?/", $thisurl)) {echo 'HTTP Query detected!';}
 else {echo 'no HTTP query detected';}

Posted: Mon Dec 10, 2007 2:36 am
by deadoralive
Are you trying to detect if any querystring parameters have been used? Why not just

if( !empty($_GET) )
{
// do stuff here
}