Forum Moderators: coopster
I can do it based on referrer, GeoIP location and much more but I'm having trouble finding anything on php-ing for crawlers.
Yahoo always caches my pages wrong and anyone that clicks the "cache" button in the Yahoo search listings gets a really messed up page.
Any help would be appreciated
Thanks
Mike
if ([url=http://us2.php.net/stri-pos]stri_pos[/url]($_SERVER['HTTP_USER_AGENT'],'slurp')!== FALSE)
stripos [uk3.php.net], must have been a typo
What are you doing within that if block?
[edited by: PHP_Chimp at 7:54 pm (utc) on Dec. 6, 2007]
While working away last night I was pondering your 500 error from the code above. As when you say you are getting a 500 error are you putting this code directly into the htaccess file? As php wont work in there.
You could use -
RewriteCont %{HTTP_USER_AGENT} slurp [NC]
RewriteRule (.*) $1 [L, E=agent:yahoo]
This should set the environmental variable $_ENV['agent'] = 'yahoo' for anything identifying itself as slurp. You could then check for this variable on every page and if it is present rewrite your tags. The example above assumes that you are not passing everyone through a single page, however you could always change the $1 to be whatever page you were using for checking for slurp.
I havent used htaccess to set environmental variables for quite a long time, so you may well need to check this code with someone who is a bit more up to date with that sort of thing.