1
我有以下線在我的.htaccess文件:爲什麼RewriteRule只有在更改行位置時才起作用?
RewriteCond %{QUERY_STRING} id=([0-9]+)
RewriteRule ^page/([0-9]+)/$ ?page=$1 [L]
RewriteRule ^(20\d\d)/page/([0-9]+)/$ ?yearMeasure=$1&page=$2 [L]
RewriteRule ^(20\d\d)/$ ?yearMeasure=$1 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/page/([0-9]+)/$ ?category=$1&page=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/$ ?category=$1 [L]
RewriteRule ^(20\d\d)/([A-Za-z0-9-]+)/$ ?type=post&year=$1&title=$2 [L,QSA]
當文件如上離開時,服務器不會捕捉/頁/ 1 /。相反,它會返回一個404錯誤。但是,當我翻轉第二和第三行時,一切都很完美。爲什麼是這樣?
RewriteCond %{QUERY_STRING} id=([0-9]+)
RewriteRule ^(20\d\d)/page/([0-9]+)/$ ?yearMeasure=$1&page=$2 [L]
RewriteRule ^page/([0-9]+)/$ ?page=$1 [L]
RewriteRule ^(20\d\d)/$ ?yearMeasure=$1 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/page/([0-9]+)/$ ?category=$1&page=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/$ ?category=$1 [L]
RewriteRule ^(20\d\d)/([A-Za-z0-9-]+)/$ ?type=post&year=$1&title=$2 [L,QSA]
編輯:
試驗幾分鐘後,似乎RewriteCond %{QUERY_STRING} id=([0-9]+)
後可直接接觸線是無效的。
任何幫助表示讚賞。