关闭apache中的重定向循环错误
我正在使用 php 抓取网站。 由于我不太了解如何将 php 转换为 CGI 并从命令行运行,所以我选择的方法是,在一次成功的迭代之后,重定向回同一个 php 文件,以便它再次运行(这不是一个无限循环,因为我使用 cookie 和时间戳检查来确保它在设定的时间内或在几百次迭代后结束。
我不断遇到的问题是,经过 20 次迭代左右后,我收到以下错误消息:
重定向循环
此网址的重定向限制 超过了。 无法加载 请求的页面。 这可能是由于 被阻止的 cookie。
我怎样才能阻止apache/php(我在本地主机上使用xampp)阻止我按照我的意愿循环。
I'm crawling a website using php. As I don't know much about turning php into a CGI and runing from command line the method I've chosen is, after one succesful iteration, to redirect back to the same php file so it runs again (it's not an infinite loop as I use both a cookie and a timestamp check to make sure it ends within a set time or after a few hundred iterations).
The problem I keep getting is that after 20 iterations or so I get the following error message:
Redirect Loop
Redirection limit for this URL
exceeded. Unable to load the
requested page. This may be caused by
cookies that are blocked.
How can I stop apache/php (I'm using xampp on my localhost) from preventing me from looping as long as i want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,这是由浏览器创建的,而不是服务器创建的。 您无法禁用客户端代码来防止重定向循环。
As far as I can tell, this is created by the browser, not the server. You can't disable client-side code to prevent redirect loops.
据我所知,如果您尝试重定向到再次重定向的页面等等,就会发生这种情况。
每个浏览器都有一个限制,在firefox中你可以在about:config中设置它,但其他浏览器没有这样的选项。
As far as I know, this happens if you try to redirect to a page which redirects again and so on.
Each brwoser has a Limit, with firefox you can set it in the about:config, but the other browsers don't have that kind of option.