【问题标题】:Debian 404 The request url not found on this serverDebian 404 在此服务器上找不到请求 url
【发布时间】:2014-09-27 16:19:17
【问题描述】:

我是 linux 环境的新手。我已经安装了 debian os 和 apache2 服务器。我一直在做一个代码点火器项目。我的问题是,我能够在代码点火器中呈现索引文件。但是如果我进入像 localhost/login 或 localhost/register 这样的内页,我会得到这个

The requested url not found on this server 

错误。如何克服这个?

这是我的 apache2/sites-enabled/000-default

ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

【问题讨论】:

    标签: php linux apache debian http-status-code-404


    【解决方案1】:

    启用 apache2 模块“mod_rewrite”

    a2enmod rewrite
    

    之后,允许你的目录用

    覆盖这个模块的规则
    AllowOverride FileInfo
    

    【讨论】:

      【解决方案2】:

      我不使用 CodeIgniter,但据我所知,我希望它在 .htaccess 中使用 mod rewrite,这意味着您的 &lt;Directory /&gt;&lt;Directory /var/www/&gt; 应该是 AllowOverride All。您可能还需要在命令行中a2enmod rewrite

      【讨论】:

      • 将 Allowoverride None 更改为 Allowoverride All 成功了。谢谢:)
      • 不要使用关键字“全部”!每次只允许你真正需要的东西!
      猜你喜欢
      • 2020-07-01
      • 2017-01-25
      • 2014-03-26
      • 2014-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-22
      • 2017-10-31
      相关资源
      最近更新 更多