我有我的htaccess重寫以下規則:htaccess的重寫補充「的index.php」當我添加一個尾部斜槓地址
RewriteRule ^([a-zA-Z0-9\-]*)/([0-9]*)/([a-zA-Z0-9\-_]*)$ /content.php?a=$1&b=$2&c=$3
RewriteRule ^([a-zA-Z0-9\-]*)/([0-9]*)$ /content.php?a=$1&b=$2
RewriteRule ^([a-zA-Z0-9\-]*)$ /index.php?a=$1
,當我去「那個奇妙的作品mydomain.com/nameofpage「
但是當我添加一個尾部斜線」mydomain.com/nameofpage/「時,瀏覽器將」index.php「添加到最後和404的我。
的思考?
謝謝!
編輯。 想通了。
看起來像我在使用的前兩個重寫*的是戰勝了我的最終規則......長話短說,下面是一個正常工作的代碼(改爲*到+在三個地方):
RewriteRule ^([a-zA-Z0-9\-]*)/([0-9]+)/([a-zA-Z0-9\-_]+)$ /content.php?a=$1&b=$2&c=$3
RewriteRule ^([a-zA-Z0-9\-]*)/([0-9]+)$ /content.php?a=$1&b=$2
RewriteRule ^([a-zA-Z0-9\-]*)$ /index.php?a=$1
只需在'$' – scibuff 2012-02-24 10:52:03
之前加'/?'就行了t說,沒有變化 – PotatoFro 2012-02-24 11:00:50
**弄明白了**,但我沒有足夠的聲譽發佈我自己的答案......這裏是: 想通了......看起來像我使用的*前兩個重寫是我的最終規則...長話短說,這裏是代碼工作正常(在三個地方更改*到+): '重寫規則^([a-zA-Z0-9 \ - ] *)/([0-9] +)/([a-zA-Z0-9 \ -_] +)$ /content.php?a=$1&b=$2&c=$3 RewriteRule ^([a-zA -Z0-9 \ - ] *)/([0-9] +)$ /content.php?a=$1&b=$2 RewriteRule ^([a-zA-Z0-9 \ - ] *)$/index .php?a = $ 1' – PotatoFro 2012-02-24 11:08:32