Apache .htaccess重写规则有问题

Apache .htaccess重写规则有问题,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我有这样的规则,那不行 RewriteRule ^(.+)\/(.+)\/$ /index.php?pg=$1&act=$2 这段代码应该做的是将ofrm/somthing/other/转换成/index.php?pg=somthing&act=other 通过一些测试,我发现pgvar也没有通过 我还有一行类似的代码,RewriteRule^(.+)\/$/index.php?pg=$1a it work!所以,我不知道为什么第一个没用 如果您不需要使用除a-z和0-9以外的任何其他

我有这样的规则,那不行

RewriteRule ^(.+)\/(.+)\/$ /index.php?pg=$1&act=$2
这段代码应该做的是将ofrm
/somthing/other/
转换成
/index.php?pg=somthing&act=other

通过一些测试,我发现
pg
var也没有通过


我还有一行类似的代码,
RewriteRule^(.+)\/$/index.php?pg=$1
a it work!所以,我不知道为什么第一个没用

如果您不需要使用除a-z和0-9以外的任何其他字符,我建议您使用:

RewriteRule^([a-z0-9-]+)/([a-z0-9-]+)$/index.php?pg=$1&act=$2


它应该可以工作。

我不是正则表达式的专家,但是,什么是正则表达式?最后呢?我也是,但我总是这样写.htaccess。它对我和你都有效:
RewriteRule^(+.+)\/(.+)\/?$/index.php?pg=$1&act=$2
,有了这个问题markOk,这太疯狂了。。使用“?”时,所有网站都停止工作!:|
RewriteRule^(+)/(++)$/index.php?pg=$1&act=$2
适合我,没有“?”@Daniel let us