2014-03-31 72 views
1

我遇到有关.htacces困难,我希望有人能帮助..htaccess的重定向

我需要做一个重定向,但不能得到查询字符串值.. (我也做重定向WWW到现在-WWW)

RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteRule ^(.*).htm$ index.php?route=$1 [L] 

,当我做出请求以/a/td.htm?td=2

$ _GET [ '路线']

打印

a/td 

我需要得到

a/td=2 

不幸的是我不能找到一种方法。

在此先感谢

回答

0

您可以使用:

RewriteEngine On 
RewriteBase/

RewriteCond %{HTTP_HOST} ^www\. [NC] 
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{QUERY_STRING} ^td=([^&]+) [NC] 
RewriteRule ^(.+?)\.htm$ index.php?route=$1=%1 [L]