2012-09-23 40 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