我有一个名为products
的文件夹,我想用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
到
abc.com/products/toshiba-laptop/toshiba/3
答案 0 :(得分: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]