开发者

php - How reliable is HTTP_HOST, and will it work for search bots?

I have numerous domains and rather than create content for each one individually, I'm using the following code in each index.php page to display the relevan开发者_开发百科t page from another site I own (where 'getDomain' is a function for getting just the domain from a url):

<?php
$domain = $_SERVER['HTTP_HOST'];
$domain = getDomain($domain);
$crawl = "http://example.co.uk/page.php?domain=$domain";
$request = curl_init($crawl); 
print curl_exec($request); 
curl_close($request);
?>

Anyway, my questions are 1) is it reliable to use HTTP_HOST like this and 2) will search engine bots index my page or will they just get an error?

My hunch is that I'm better off entering the domain name into each index.php page - but I'd rather not have to do that!

Any help greatly appreciated!


This will work ok (and for search engines too), but can be realy slow... If you content and design not differs in diferent domains, better way is to configure normal web-server virtualhosts for that

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜