如何防止动态内容上出现重复的标题标记

问题描述:

Links on the website I am making currently look like this:

http://www.example.net/blogs/151/This-is-a-title-in-a-url

My php system pulls out the id (151 say) and uses that to pull to content from my database. The text afterwards is effectively ignored (much like * uses).

Now my problem is that this creates duplicate titles that Google will sometimes index and I lose SEO as a result:

http://www.example.net/blogs/151/This-is

http://www.example.net/blogs/151/

What is the best way to make it so that google and other search engines only see the correct full link so that I don't end up with duplicates and get the best ranking possible?

EDIT: I notice that with * site that you get dynamically redirected to another page? How do they do that?

我正在制作的网站链接目前如下: p>

  http://www.example.net/blogs/151/This-is-a-title-in-a-url
  code>  
 
 

我的php系统提取id( 151 code>)并使用它来从我的数据库中提取内容。 之后的文本被有效忽略(就像*使用的那样)。 p>

现在我的问题是,这会创建重复的标题,谷歌有时会将其编入索引,因此我会丢失搜索引擎优化: p>

  http://www.example.net/blogs/151/This-is

http://www.example.net/ 博客/ 151 / 
  code>  pre> 
 
 

最好的方法是让谷歌和其他搜索引擎只看到正确的完整链接以便我不会最终 有重复项并获得最佳排名吗? p>

编辑: strong>我注意到,通过*站点,您可以动态地重定向到另一个页面? 他们是如何做到的? p> div>

Pick a URI to be canonical.

When you get a request for http://example.com/123/anything then, instead of ignoring the anything, compare it to the canonical URI.

If it doesn't match, issue a 301 Moved Permanently redirect.


A less optimal approach would be to specify the canonical URI in the page instead of redirecting:

<link rel="canonical" href="http://example.com/123/anything"/>