AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 893537
Accepted
ReynierPM
ReynierPM
Asked: 2018-01-23 09:51:40 +0800 CST2018-01-23 09:51:40 +0800 CST 2018-01-23 09:51:40 +0800 CST

“选项指令禁止的目录索引”可能是“请求超出 10 个内部重定向的限制”的原因吗?

  • 772

我正在尝试在我的本地环境中设置一个项目,以便我能够处理它。正在使用 PHP 5.3.3,Apache 2.2.15 和 CodeIgniter 2.3.1(PHP 和 CI 版本在这里不相关,但仅供参考,以防万一需要)。

我已经设置了一个 VH 如下:

<VirtualHost *:80>
    DocumentRoot "/var/www/html/document_api/public"
    ServerName document.api.localhost    
    <Directory "/var/www/html/document_api/public">
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    LogLevel debug
</VirtualHost>

项目/var/www/html/document_api/public/.htaccess文件如下:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

#Rule 2: IF a file exists when .php is added, then rewrite URL by adding .php
RewriteRule ^([0-9A-_Za-z]+)$ $1.php [L]

RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

当我尝试点击 URL 时,document.api.localhost:8080我得到了以下错误:

[Mon Jan 22 17:25:50 2018] [error] [client 10.0.2.2] Directory index forbidden by Options directive: /var/www/html/document_api/public/
[Mon Jan 22 17:25:50 2018] [error] [client 10.0.2.2] File does not exist: /var/www/error
[Mon Jan 22 17:25:51 2018] [error] [client 10.0.2.2] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3112): [client 10.0.2.2] r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/ [Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /index.php/favicon.ico, referer: http://document.api.localhost:8080/
[Mon Jan 22 17:25:51 2018] [debug] core.c(3118): [client 10.0.2.2] redirected from r->uri = /favicon.ico, referer: http://document.api.localhost:8080/

我在这里错过了什么吗?这个设置有什么问题?

apache-2.2
  • 1 1 个回答
  • 1293 Views

1 个回答

  • Voted
  1. Best Answer
    Ondřej Xicht Světlík
    2018-01-23T12:40:06+08:002018-01-23T12:40:06+08:00

    您的日志文件中有两个问题。首先是目录索引被禁止,这是由于

    RewriteCond %{REQUEST_FILENAME} !-d
    

    请求的路径显然是一个目录,它是DocumentRoot目录。因此跳过了重定向到 PHP 的规则。而且您可能没有,index.php因为您的DirectoryIndex目录列表是被禁止的(文档)。

    第二个问题,无限重定向,是由另一个请求引起的,这次是浏览器请求favicon.ico. 该文件不存在并被重写到index.php/favicon.ico,但不存在这样的文件或文件夹,它被重写到index.php/index.php/favicon.ico等等。

    您可能应该跳过重定向index.php/something并将其更改为 GET 参数,我看不出您尝试以这种方式重定向它的任何原因。/index.php?path=something会更有意义。

    • 0

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 上的子域不工作 - 找不到服务器

  • PHP 作为 CGI 还是 Apache 模块?

  • 避免将某些丢失的文件记录到 Apache2 错误日志中

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve