我正在尝试将我网站上的 URL 从 .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 等)。
任何建设性的帮助表示赞赏。