Forum Moderators: coopster
I wonder if you can help?
We have <?php
if((is_home() && ($paged < 2 )) ¦¦ is_single() ¦¦ is_page() ¦¦ is_category()){
echo '<meta name="robots" content="index,follow" />';
What i would like to to do is noindex, nofollow, all urls with numbers for in folder /tag/386 for eg so that any number following /tag/is blocked
I cannot for the life of me find any php code for greater than
Kind regards
Les
Far from being expert in PHP and fearing perhaps I miss what you really mean by your question about greater than:
Your snippet is using 'less than' on the variable '$paged', to make this snippet the opposite (and so using 'greater than' in PHP) just exchange the '<' symbol for a '>'. Without writing a lot of script out (*Google: conditional php), you are probably better off with something like;
<?php
if (Con_Index()>0) {
echo WriteMeta("robots","index,follow");
} else {
echo WriteMeta("robots","noindex,nofollow");
}
?>
There will of course be a million ways this can be tackled and probably ten percent of them are worth the time taken to write and test them, I don't blame you for wanting to back your robots.txt file up but if a bot is ignoring robots.txt it is at least a bit unlikely it will honour even 'rel="nofollow"'.
Good luck,
robsoles.
i am guessing you use htaccess for this?
if so... you urls are being constructed as http://www.example.com/tag/$somevar/$othervar/$pagename.htm
if i am guessing right this far...
if((int)$_GET['somevar']>0)
{
echo '<meta name="robots" content="noindex,nofollow" />';
}
As far as im aware there are no robots that support the robots.txt file that dont support the meta tags, this also works the other way around. So either method should work, just 2 lines in robots.txt is a lot quicker than a php alternative.