【发布时间】:2014-03-12 08:11:33
【问题描述】:
我创建了一个新的 OpenCart 1.5.6 商店 - http://www.example.eu - 但是,它的许多页面(就文本上下文而言)与仍在运行的旧商店中的页面相同 - http://www.example.co.uk
将两个网站都编入索引后,我想通过在新网站中包含规范标签来引用旧网站上所有相同的页面:
例如http://www.example.eu/about-us 的“关于我们”页面理想情况下应该在其头部有类似的内容:
<link rel="canonical" href="http://www.example.co.uk/delivery"/>
例如http://www.example.eu/delivery 的“交付”页面理想情况下应该在其头部部分包含类似的内容:
<link rel="canonical" href="http://www.example.co.uk/delivery"/>
我知道这在理论上是如何实现的,但无法在实践中应用。此外,虽然我最关心的是所有信息类型的页面,但理想情况下,我希望能够指定具有规范标签的确切页面,例如:
If (this page is About-Us OR Delivery OR … OR … OR … OR …)
{
Include Canonical Tag of the type <link rel="canonical" href="http://www.example.co.uk/xxxxxxxx"/> ,
where xxxxxxx changes accordingly, depending on the page.
}
Else
{
Don’t include Canonical Tag
}
【问题讨论】:
-
取决于你的页数,我可以使用
in_array()函数。然后,您可以指定数组中的所有页面(url)并传递它。 -
那么使用
301(内容移动)代码从旧页面重定向到新页面怎么样?这可以在.htaccess文件中实现。
标签: php seo opencart canonical-link