下面的代碼是針對特定於幾個頁面的根文件夾來刪除擴展名。它的工作。.htaccess在子文件夾中刪除擴展名不起作用
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^About+$ about.php
RewriteRule ^FAQ+$ faq.php
RewriteRule ^Contact+$ contact.php
RewriteRule ^Gallery+$ gallery.php
RewriteRule ^Areas-we-service+$ cities.php
RewriteRule ^(([^/]+/)*[^.]+)$ servicesparse.php?name=$1
然後我添加了一個名爲product的子文件夾。 路徑是根文件夾/ php-product-catalog-module。插件中有另一個htaccess文件。
#Fix Rewrite
Options -Multiviews
# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /php-product-catalog-module/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# used for viewing single product page
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\/?$ product.php?name=$1&id=$2
# used for php pages such as "yoursite.com/login.php" will become "yoursite.com/login/"
RewriteRule ^([a-z_]+)\/?$ $1.php [NC]
因此,子文件夾的htaccess不起作用。 它不會重定向http://cp2.designnrank.com/~wolverin/php-product-catalog-module/login.php到http://cp2.designnrank.com/~wolverin/php-product-catalog-module/login
產品其他頁面的規則不起作用。