【问题标题】:apache mod_rewrite: maximum number of internal redirects reachedapache mod_rewrite:达到内部重定向的最大数量
【发布时间】:2011-08-18 03:01:39
【问题描述】:

我遇到了如何配置这个问题,测试站点工作正常,“http://test.domain/beta/”但是当我们配置域“http://prod_domain/”时,指向在同一目录上,它返回一个 http 500 错误,我检查了 apache 错误日志并得到了这个:

mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

这是我的 .htaccess 之类的:

RewriteEngine On
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php?/$1 [L]

【问题讨论】:

  • 可以在rewritecond中指定$1吗?

标签: php apache codeigniter mod-rewrite


【解决方案1】:

您需要对 REQUEST_URI 进行条件匹配,并在匹配的前面加上一个斜杠:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php?/$1 [L]

【讨论】:

  • 此外,on the CodeIgniter Wiki 提供了一个完整的 mod_rewrite 示例,其中包括 %{REQUEST_URI} 位。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-02
  • 2013-05-26
  • 2015-01-04
相关资源
最近更新 更多