2014-12-27 128 views
0

我有名字products一个文件夹,我想与htaccess的重写(htaccess的被放置在文件夹中)的.htaccess规则不工作

我已经使用的代码是

Options +FollowSymLinks -MultiViews 
RewriteEngine On 
RewriteBase /products/ 

RewriteRule ^([a-z]+)/([a-z]+)/([0-9]+)$ index.php?product=$1&brand=$2&page=$3 [L,QSA] 

现在我想实现是 我想

abc.com/products/index.php?product=toshiba-laptop&brand=toshiba&page=3 

0转换
+0

你有没有设置'的AllowOverride all'在你的虚拟主机? – Stony 2014-12-27 17:21:53

+0

yes allowoverride设置为全部 – opncart 2014-12-27 17:23:00

+0

@opncart'([0-9] +)'应该与'toshiba'匹配吗? – Sumurai8 2014-12-27 17:43:52

回答

0

解决自己的感谢代码的用途是

RewriteRule ^([^/.]+)/?$ index.php?cat=$1 [L] 
RewriteRule ^([^/]*)/([a-z-]+)$ index.php?cat=$1&brand=$2 [L] 
RewriteRule ^([^/]*)/([0-9]+)$ index.php?cat=$1&page=$2 [L] 
#RewriteRule ^([^/]*)/([a-z-]+)/(.*)/$ index.php?cat=$1&brand=$2&page=$3 [L] 
RewriteRule ^([a-z]+)/([a-z]+)/([0-9]+)$ index.php?cat=$1&brand=$2&page=$3 [L,QSA]