apache 如何停止无限重定向循环?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/832736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:34:10  来源:igfitidea点击:

How to I stop an infinite redirect loop?

apache.htaccessredirect

提问by Alex Mcp

I have a blog that has a redirect loop, and I can't understand htaccess too well right now (late, and needs to be done by the AM) so am hoping for a quick fix. The site is throwing 301s from xxxxx.org to xxxxx.org/index.php, and back to the beginning. The htaccess file is as follows:

我有一个有重定向循环的博客,我现在不太了解 htaccess(晚了,需要由 AM 完成)所以我希望能快速修复。该站点将 301 从 xxxxx.org 扔到 xxxxx.org/index.php,然后又回到开头。htaccess 文件如下:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

redirect 301 /index.html http://www.lawyersclearinghouse.org/index.php

The site was recently listed on google as malicious due to an iFrame injection, so please don't feel the need to visit it (cleaned, but not yet delisted)

由于 iFrame 注入,该网站最近在 google 上被列为恶意网站,所以请不要觉得有必要访问它(已清理,但尚未除名)

回答by Jay Dubya

Your rewrite conditions are combined with a logical OR so they will apply in all cases. If the file is a plain file it will not be a directory and vice versa.

您的重写条件与逻辑 OR 组合在一起,因此它们将适用于所有情况。如果文件是纯文件,则它不会是目录,反之亦然。

Your rule is also odd. Are you trying to match all cases? in that case it should presumable be .* (any string of characters) rather than . (any single character)

你的规则也很奇怪。您是否试图匹配所有情况?在这种情况下,它应该是 .* (任何字符串)而不是 . (任何单个字符)

回答by bdonlan

Your site seems to work for me. Anyway, make sure index.php exists.

你的网站似乎对我有用。无论如何,请确保 index.php 存在。