0
我有以下.htaccess文件,我想知道如何編輯它以添加尾部斜線並保持相同的URL。現在,如果我訪問沒有結尾斜槓的鏈接,它會添加斜槓,但會丟失「www」。在'mywebsite.com'前面。有任何想法嗎?忽略斜線(.htaccess)後錯誤的重定向
Options +FollowSymLinks
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*).html
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://mywebsite.com/$1/ [L,R=301]
RewriteRule ^artists/([^/-]+)-p([^/]+)/$ /artists.php?l=$1&p=$2 [QSA,L]
RewriteRule ^artists/([^/]+)/$ /artists.php?l=$1 [QSA,L]
RewriteRule ^lyrics/(.*)/(.*)/(.*).html /artists-lyrics.php?a=$1&b=$2&c=$3
RewriteRule ^lyrics/(.*)/(.*).html /artists-lyrics.php?a=$1&c=$2 [QSA,L]
RewriteRule ^lyrics/([^/]+)/([^/]+)/$ /artists-albums.php?a=$1&b=$2 [QSA,L]
RewriteRule ^lyrics/([^/]+)/$ /artists-details.php?a=$1 [QSA,L]
RewriteRule ^latest/p-([^/-]+)-([^/]+)/$ /latest.php?p=$1&q=$2 [QSA,L]
RewriteRule ^save-([^/-]+)-([^/-]+)/$ /save.php?t=$1&s=$2 [QSA,L]
RewriteRule ^latest/$ /latest.php [QSA,L]
RewriteRule ^top100/$ /top100.php [QSA,L]
RewriteRule ^p-([^/-]+)-([^/]+)/$ /index.php?p=$1&q=$2 [QSA,L]
RewriteRule ^submit/$ /submit.php [QSA,L]
RewriteRule ^users/$ /users.php [QSA,L]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.mywebsite.com/$1 [R=301,L]
好的,如果我想將所有沒有www的請求重定向到www的url? – Psyche 2010-10-21 21:00:23
這是一個單獨的問題,不屬於現有問題的評論。此外,有幾十條文章告訴你兩條線的規則,以完成快速搜索。 – 2010-10-21 22:24:41