2016-03-14 73 views
0

我有此鏈接的WordPress的產品主頁:www.example.com/products/麻煩與.htaccess的查詢

,我也創建這種URL的定製產品頁面:www.example。 COM /產品/黑盔

現在..我的htaccess的文件包括此行:

RewriteRule ^products/(.*) products.php?name=$1 

我如何添加,「如果沒有變量在產品/(.*),使用wordpress原創頁面鏈接www.example.com/products/ ..其他,products.php?name = $ 1

回答

0

嘗試:

#1--if the request is "/products/" , let it pass through unchanged--# 
RewriteRule ^products/?$ - [L] 
#2--if the request is "/product/foobar" ,rewrite it to "/products.php?name=foobar--# 
RewriteRule ^products/(.+) products.php?name=$1 [L]