2016-03-14 114 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]