2012-08-22 40 views
1

阿帕奇重写我要重写从一些复杂的查询字符串

www.domain.com/index.php?search=product/model&model_name={query string} 

东西

www.domain.com/{query string}.html 

这里是我重写代码,但不能正常工作,需要一个帮助,谢谢。

RewriteRule ^index.php?search=product/model&model_name=(.*)$ index.php/$1.html 

回答

0

你不能在RewriteRule对阵查询字符串,你需要使用一个RewriteCond和比赛反对%{QUERY_STRING} VAR:

RewriteCond %{QUERY_STRING} ^search=product/model&model_name=(.*)$ 
RewriteRule ^/?index.php$ index.php/%1.html [L] 

这就所以当有人请求www.domain.com/index.php?search=product/model&model_name={query string},他们获取内容/index.php/{query string}.html,而其地址栏中的浏览器网址保持不变(仍然是包含查询字符串的网址)。

+0

谢谢,但我检查了它,仍然没有工作。 –