Apache .htaccess newb-重写规则与第二条规则不匹配,为什么?
我当前正在从迁移到.htaccess。我遇到了一些困难,我认为这是一些基本的问题,但我对.htaccess不太熟悉 我有两条规则:Apache .htaccess newb-重写规则与第二条规则不匹配,为什么?,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我当前正在从迁移到.htaccess。我遇到了一些困难,我认为这是一些基本的问题,但我对.htaccess不太熟悉 我有两条规则: RewriteRule ^testing/ /test/index.html?test=1 [NC] RewriteRule ^testing/foo-bar/ /test/index.html?test=2 [NC] 然而,第二条规则从来都不匹配。如果我去的话,我只会看到第一条规则。为什么呢?它能很容易地修复吗 我有很多规则(从数据库输出以写入.htaccess
RewriteRule ^testing/ /test/index.html?test=1 [NC]
RewriteRule ^testing/foo-bar/ /test/index.html?test=2 [NC]
然而,第二条规则从来都不匹配。如果我去的话,我只会看到第一条规则。为什么呢?它能很容易地修复吗
我有很多规则(从数据库输出以写入.htaccess文件),按特定顺序排序是不可能的。我很确定您的错误不包括美元符号 我不确定,但我认为应该是这样的:
RewriteRule ^testing$ /test/index.html?test=1 [NC]
RewriteRule ^testing/foo-bar$ /test/index.html?test=2 [NC]
非常接近!我不得不用美元符号离开后面的斜杠<代码>^/testing/$/test/index…谢谢!啊,我想你会想要刀子,不知道我为什么要把它拿出来。很高兴它成功了!