Rewrite规则理应没有问题:
<VirtualHost *:80 *:81>
ServerAdmin [email protected]
DocumentRoot /active/www/yingchao123/trade
ServerName trade.test.yingchao123.com
ServerAlias trade.yingchao123.com
RewriteEngine On
RewriteRule ^([\da-z]{1,10})$ ./index.php?mod=list&do=unique&alias=$1 [L]
RewriteRule ^([\da-z]{1,10})&(.+)$ ./index.php?mod=list&do=unique&alias=$1&$2 [L]
</VirtualHost>
但这样写会出现 出现 400 Bad Request 错误
解决方法是将rewrite规则写倒directory中:
<VirtualHost *:80 *:81>
ServerAdmin [email protected]
DocumentRoot /active/www/yingchao123/trade
ServerName trade.test.yingchao123.com
ServerAlias trade.yingchao123.com
<Directory "/active/www/yingchao123/trade">
RewriteEngine On
RewriteRule ^([\da-z]{1,10})$ ./index.php?mod=list&do=unique&alias=$1 [L]
RewriteRule ^([\da-z]{1,10})&(.+)$ ./index.php?mod=list&do=unique&alias=$1&$2 [L]
</Directory>
</VirtualHost>
重启Apache,问题解决