2014-12-27 118 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]