Apache:我的重写规则中的重定向循环。如何调试?

时间:2018-09-12 01:42:34

标签: apache mod-rewrite

TLDR:尝试访问projects.myhost.com/my-folder-here/my-page-here会导致无限循环

  1. 如何调试重定向?

  2. 我们有以下规则(请参见下文)。这是来自正在运行的虚拟主机的副本(即无重定向循环)

问题在于,如果出现第二行,则会导致无限循环(http => https => http => https等)

RewriteRule "^/$"   "/content/myhost/projects.html"  [PT,L]
RewriteCond %{QUERY_STRING} q
RewriteRule "^/content/myhost/projects/(.*).html$"   "https://%{SERVER_NAME}/$1" [L,QSA,R=301,NE]
RewriteRule "^/content/myhost/projects$"   "/"  [L,R=301]
RewriteRule "^/content/myhost$"   "/"  [L,R=301]

这是我的apache配置文件:

httpd.conf:https://pastebin.com/SyzTsFRu

projects-rewrite-rules.txt:https://pastebin.com/AzKsx8uM

projects-redirect-map.txt:https://pastebin.com/VifasMyC

projects-vanity-map.txt:https://pastebin.com/xeXzLuaG

谢谢。

0 个答案:

没有答案