【问题标题】:redirect to "/" or to index.html重定向到“/”或 index.html
【发布时间】:2012-09-23 19:49:04
【问题描述】:

目前在我的网站上,用户可以同时浏览到

www.mysite.com/index.html
www.mysite.com (which actually returns index.html)

我希望一切都消除歧义,例如要么

www.mysite.com/index.html

www.mysite.com

考虑到最佳实践是什么

  1. HTTP 请求
  2. 搜索引擎优化

谢谢, p.s.如果除了 SEO、HTTP 请求数量还有其他注意事项,请告诉我。

【问题讨论】:

    标签: http redirect seo httpwebrequest


    【解决方案1】:

    把这个放在你的.htaccess

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/ 
    RewriteRule ^(.*)index\.html$ $1 [R=301,L]
    

    【讨论】:

    猜你喜欢
    • 2010-10-27
    • 2013-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-26
    • 2021-04-26
    相关资源
    最近更新 更多