Reputation: 21
I have the url() statement in my database. all in www.site.com/random_alias format (splash pages). Some links were created by the admin (userid=1) and archived to specialized (archived=1). how can I tell Google to index URLs (just created by admin and archived) ? no index and follow for all other URLs. I have below code using php, but the filter condition doesn't work. and all pages turn to the index
<?php
foreach (\Core\DB::url()->where('userid', '1')
->where('archived', '1'))
if ($url['userid'] == 1 && $url['Archived'] == 1) {
echo '<meta name="robots" content="index, follow"/>';
} else {
echo '<meta name="robots" content="noindex, nofollow"/>';
}
endforeach;
?>
also i use this query to select
SELECT userid, archived FROM psiturl WHERE userid = 1 AND archived='1'
a correct php code to filter URLS for index and no index tags condition.
Upvotes: 1
Views: 26