我試圖重寫我的網站從.PHP爲.html的網址和我有與我想要做什麼干擾其他一些規則。如何從特定規則中排除特定的一組文件?
下面的代碼顯示了所有工作的規則,但我有一些扁平的PHP頁面,我想轉成html的網頁。一個例子是history.php history.html。
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase/
##Vendor Pages
RewriteRule ^([^/]+)/([^/]+)/([^.]+)\.html?$ vendors2.php?vendorslug=$3&locationslug=$1&categoryslug=$2 [L,QSA,NC]
##Listing Pages
RewriteRule ^([^/]+)/([^.]+)\.html?$ listings.php?locationslug=$1&categoryslug=$2 [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !^(.*/)?history\.html$ [NC]
RewriteRule ^([^/.]+)\.html?$ $1.php [L,NC]
##Locations Pages
RewriteRule ^([^/.]+)\.html?$ locations.php?locationslug=$1&Submit=Submit [L,QSA,NC]
目前,該代碼會出現,因爲它試圖返回的頁面爲「位置頁」,因爲規則要與其他規則混淆。
有,我需要轉成html的(history.php,news.php,maps.php,resources.php,trivia.php等)幾頁。
任何建設性的幫助表示讚賞。
我建議你打開改寫記錄... – arkascha
arkascha,謝謝你的提示。我還沒有嘗試重寫日誌。我會閱讀它並嘗試它。再次感謝。 – NotJay