2012-09-23 44 views
-1

目前在我的网站,用户既可以浏览到重定向到“/”或index.html的

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

我想要的一切,以消除ambuguity,例如无论是

www.mysite.com/index.html 

OR

www.mysite.com 

什么是使用的最佳实践,考虑

  1. HTTPRequests的
  2. SEO

谢谢, 附:如果除SEO之外还有其他任何考虑因素,HTTP请求的数量,请告诉我。

回答

2

把这个在您的.htaccess

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

谢谢,但问题不是如何重定向(虽然,我还不知道),但“什么是更好的?有或无/index.html “ – Yura

+0

我认为你应该保留”/“。见http://www.searchenginejournal.com/should-urls-in-links-use-indexhtml/4434/ – MWC

+0

谢谢。这一个http://googlewebmastercentral.blogspot.co.il/2006/12/deftly-dealing-with-duplicate-content.html也很好。 – Yura

相关问题