1
我的根目錄包含一些.html文件。 我想刪除地址欄一個.html的擴展,到底這樣添加斜線:http://domain.com/page/ 我試過很多的解決方案,其中之一:刪除擴展名並在靜態html上添加斜線
RewriteEngine on
RewriteBase/
# redirect from ww to non-www
RewriteCond %{HTTP_HOST} ^www.nightmaar.com$ [NC]
RewriteRule ^(.*)$ http://nightmaar.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.html
RewriteRule (.*)\.html$ /$1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ $1.html [L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule .*[^/]$ $0/ [L,R=301]
但瀏覽器提供了一個錯誤(太多重定向)。當我試圖訪問我的靜態html頁面時,沒有從page.html重定向到/ page /。
請幫我解決一下這個問題:S
嗯,檢查這種方式 - 不工作。 – 2011-12-16 10:27:16