从 index.php?type=search&q=* 重写为 search/?q=*

Rewrite from index.php?type=search&q=* to search/?q=*

我要重写的URL是:

http://domain.com/index.php?type=search&q=something

http://domain.com/search/?q=something

我已经创建了 .htaccess 文件并将此代码用于重写:

RewriteEngine On  
RewriteRule ^search/?q=(.*)$ index.php?type=search&q= [QSA,L]

但是没用。

你可以使用它:

RewriteEngine On 
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule ^search/$ index.php?type=search&q=%1 [L]