Mod rewrite 重写不工作(匹配多个)
很抱歉标题不好 我有一条我认为很简单的规则:Mod rewrite 重写不工作(匹配多个),mod-rewrite,ubuntu,rewrite,Mod Rewrite,Ubuntu,Rewrite,很抱歉标题不好 我有一条我认为很简单的规则: RewriteRule ^(blog|articles|other)(/?)$ articles/?type=$1 然后我点击了www.mysite.com/other 但是页面正在变为“文章”类型 在此处插入我搔头的图片。您的规则将导致无限循环。将代码替换为以下内容: RewriteCond %{QUERY_STRING} ^$ [NC] RewriteRule ^(blog|articles|other)(/?)$ articles/?type
RewriteRule ^(blog|articles|other)(/?)$ articles/?type=$1
然后我点击了www.mysite.com/other
但是页面正在变为“文章”类型
在此处插入我搔头的图片。您的规则将导致无限循环。将代码替换为以下内容:
RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^(blog|articles|other)(/?)$ articles/?type=$1 [L,QSA,NC]
由于目标URI也是
/articles/
,这将一次又一次地匹配条件模式,直到Apache超出重写限制并抛出500个。想知道他/她为什么说正在获取类型为class='articles'。我刚刚从(blog | articles | other)中删除了“articles”,似乎已经修复了它(?)因为文章实际上是你提到的目标。很高兴知道你的问题得到了解决。请将答案标记为已接受,以解决此问答。