Apache ReWriteEngine因内部重定向过多而导致500内部服务器错误...为什么?

Ste*_*n G 1 php apache mod-rewrite redirect

我正在尝试在我的本地开发机器上实现一个新的ReWrite规则.我已经设置了13条规则,并且一切正常(即使是在撰写本文时).但是,由于某种原因,最新的一个给我带来了500个内部服务器错误.

重写规则是:

RewriteRule stuff/public_html/vault/mystuff/view/(.*) /stuff/public_html/vault/mystuff/view/index.php?stuff=$1

RewriteRule stuff/public_html/vault/mystuff/view/(.*)/ /stuff/public_html/vault/mystuff/view/index.php?stuff=$1
Run Code Online (Sandbox Code Playgroud)

检查了我的apache日志,得到了这个:

[Thu Jan 13 22:07:43 2011] [error] [client ::1] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary., referer: http://localhost:8888/stuff/public_html/vault/mystuff/all/index.php?curr=7
Run Code Online (Sandbox Code Playgroud)

在脚本上我试图重定向到view/index.php?stuff = $ 1,没有任何东西甚至可以远程类似于任何类型的重定向.我确实在登陆脚本的顶部调用了一个非常非常基本的会话验证程序,如下所示:

//Start session
 session_start();

 //Check whether the session variable SESS_MEMBER_ID is present or not
 if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
  header("location: ".$root_http."");
  exit();
 }
Run Code Online (Sandbox Code Playgroud)

但是,当我直接访问页面时,它会按预期运行,并且没有重定向.我的所有其他ReWrite规则及其相应的登录页面设置方式完全相同.

这让我大吃一惊.任何帮助,请!?

根据Marc BI的建议启用了RewriteLog,并想出了这个:

:: 1 - - [13/Jan/2011:23:00:09 - 0500] [localhost/sid#807df8] [摆脱#941b38/initial/redir#10](2)[per-dir/Users/stepheng/Development /]重写stuff/public_html/vault/mystuff/view/index.php - > /stuff/public_html/vault/mystuff/view/index.php?stuff=index.php

:: 1 - - [13/Jan/2011:23:00:09 - 0500] [localhost/sid#807df8] [摆脱#941b38/initial/redir#10](3)split uri =/stuff/public_html/vault/mystuff/view/index.php?stuff = index.php - > uri =/stuff/public_html/vault/mystuff/view/index.php,args = stuff = index.php

:: 1 - - [13/Jan/2011:23:00:09 - 0500] [localhost/sid#807df8] [摆脱#941b38/initial/redir#10](3)[per-dir/Users/stepheng /开发/]将模式'stuff/public_html/vault/mystuff/view /(.*)/'应用到uri'/stuff/public_html/vault/mystuff/view/index.php'

:: 1 - - [13/Jan/2011:23:00:09 - 0500] [localhost/sid#807df8] [摆脱#941b38/initial/redir#10](1)[per-dir/Users/stepheng/Development /]内部重定向与/stuff/public_html/vault/mystuff/view/index.php [内部重定向]

看起来它正试图发送参数?stuff = index.php,但我不知道这是怎么回事.有任何想法吗?

Mar*_*c B 5

打开重写日志记录:

 RewriteLog /path/to/rewritelog.file
 RewriteLogLevel 9
Run Code Online (Sandbox Code Playgroud)

在你的httpd.conf中.这基本上记录了重写引擎所做的一切,你将能够看到URL通过系统的确切路径,并且很可能是为什么它正在做看起来无限循环的原因