douyao4632 2012-02-08 12:53
浏览 47
已采纳

在页面URL中强制执行slug?

I'm deciding whether or not to make the slug mandatory in order to view a submission.

Right now either of these works to get to a submission:

domain.com/category/id/1/slug-title-here

domain.com/category/id/1/slug-blah-foo-bar

domain.com/category/id/1/

All go to the same submission.

You can also change the slug to whatever you want and it'll still work as it just checks for the category, id, and submission # (in the second example).

I'm wondering if this is the proper way to do this? From an SEO standpoint should I be doing it like this? And if not, what should I be doing to users who request the URL without the slug?

  • 写回答

4条回答 默认 最新

  • dra8603 2012-02-08 13:10
    关注

    The slug in the url can serve three purposes:

    1. It can act as a content key when there is no id (you have an id,so this one doesn't apply)
    2. When just a url is posted as a link to your site, it can let users know what content to expect because they see it in the url
    3. It can be used by search engines as a ranking signal (Google does not use url words as a ranking signal very much right now as far as I can tell)

    Slugs can create problems:

    1. Urls are longer, harder to type, harder to remember, and often get truncated
    2. It can lead to multiple urls for the same page and SEO problems with content duplication

    I am personally not a fan of using a slug unless it can be made the content key because of the additional issues it creates. That being said, there are several ways to handle the duplicate content problems.

    Do nothing and let search engines sort out duplicate content

    They seem to be doing better at this all the time, but I wouldn't recommend it.

    Use the canonical tag

    When a user visits any of the urls for the content, they should get a canonical tag like such:

    <link rel="canonical" href="http://domain.com/category/id/1/slug-title-here" />
    

    As far as Google is concerned, the canonical tag can even exist on the canonical url itself, pointing to itself. Bing has advised against self referential canonical tags though. For more information on canonical tags see: http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

    Use 301 redirects

    Before canonical tags, the only way to avoid duplicate content would be with 301 redirects. Your software can examine the url path, and compare the slug to the correct slug. If they don't match, it can issue a 301 redirect that will send the user to the canonical url with the correct slug. The stack overflow software works this way.

    so these urls:

    domain.com/category/id/1/slug-blah-foo-bar
    domain.com/category/id/1/
    

    would redirect to

    domain.com/category/id/1/slug-title-here
    

    which would be the only url that would actually have the content.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错