0
根據谷歌的建議,我試圖添加一些代碼到我的.htaccess以防止重複的內容。 這是我的代碼:刪除尾部斜槓htaccess
#Duplicate Content
RewriteCond %{HTTP_HOST} !^www.soomar63.com$ [NC]
RewriteRule ^(.*)$ http://www.soomar63.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.soomar63.com/ [R=301,L]
#Remove Trailing Slash
RewriteCond %{HTTP_HOST} ^(www.)?soomar63\.com$ [NC]
RewriteCond %{THE_REQUEST} !administrator/(.*)$
RewriteRule ^(.*)/$ http://www.soomar63.com/$1 [R=301,L]
此代碼工作正常,它只是有一個小問題:
此代碼更正以下鏈接:
soomar63.com -> www.soomar63.com
soomar63.com/ -> www.soomar63.com
soomar63.com/index.php/ -> www.soomar63.com
soomar63.com/about.html/ -> www.soomar63.com/about.html
但忽略了最低校正以下鏈接:
soomar63.com/index.php?mylink/ -> must correct to www.soomar63.com/index.php?mylink
soomar63.com/about.html#mylink/ -> must correct to www.soomar63.com/about.html#mylink
請幫忙。 謝謝。
感謝您的重播更換你
#Remove Trailing Slash
規則,但它並沒有解決我的問題,這個代碼在我的網站創建無限循環並給出了錯誤頁面...... – user3483889@ user3483889嘗試更新的規則。 –