【问题标题】:htaccess issue after connecting domain to subfolder将域连接到子文件夹后的 htaccess 问题
【发布时间】:2011-11-25 17:01:47
【问题描述】:

我对 .htaccess 有疑问。我在主服务器文件夹中有一个网站和一个指向它的域(adriatic.pl)。不,我已经制作了一个新版本的网站并将其放在“adriatic_new”文件夹中。当我运行 adriatic.pl/adriatic_new/public 时,一切正常,但是当我将域 (adriatic.pl) 直接连接到“adriatic_new”文件夹时,我得到“500 Internal Server Error”。

我发现它可能是 .htaccess 的问题,如何编辑它以使其工作?

看起来像这样:

SetEnv APPLICATION_ENV development
Allow from all

DirectoryIndex main.php

RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}/static/index.html -f
RewriteRule ^/*$ static/index.html [L]

RewriteCond %{DOCUMENT_ROOT}/static/%{REQUEST_URI}.html -f
RewriteRule .* static/%{REQUEST_URI}.html [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.*)/+$
RewriteRule ^.*$ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ main.php [NC,L]

php_flag magic_quotes_qpc off
php_flag register_globals off

【问题讨论】:

  • 您是否检查了 apache error_log 文件的内容以了解生成 500 错误的原因?
  • 我现在做了,我得到的是像这样的数十个错误“[Thu Nov 24 21:57:20 2011] [error] [client 80.239.22.30] script '/home/adriatic/ ftp/adriatic_new/public/news.php'未找到或无法启动”
  • 我一直在尝试使用 htaccess,现在当我转到“adriatic.pl/pages/page/id/13”之类的子页面时,我得到 404 文件未找到,我打赌当我输入这样的 URL 时“adriatic.pl/index.php?pages/page/id/13”然后它工作得很好(如果我添加“index.php?”,整个网页都可以工作。
  • 您在评论中使用了 index.php,但在您的示例中,您使用的是 main.php。尝试将 main.php 重命名为 index.php
  • 我做了,现在我 gaet "[Fri Nov 25 07:43:06 2011] [error] [client 87.205.180.214] 由于可能的配置错误,请求超出了 10 个内部重定向的限制。使用'LimitInternalRecursion' 必要时增加限制。使用 'LogLevel debug' 获取回溯。引用者:adriatic.pl"

标签: zend-framework .htaccess dns


【解决方案1】:

好吧,伙计们(和女士们?) - 问题解决了。

我所要做的就是在我的 .htaccess 中添加“RewriteBase /”。如此简单却又如此令人困惑和烦人。谢谢。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-19
    • 2011-02-20
    • 1970-01-01
    • 2016-01-18
    • 2021-08-14
    • 1970-01-01
    • 2012-05-19
    相关资源
    最近更新 更多