【问题标题】:Apache looks for index.php files in Laravel 5Apache 在 Laravel 5 中查找 index.php 文件
【发布时间】:2015-09-10 02:08:37
【问题描述】:

我是 Laravel 的初学者,在 CentOS 6.5 和 Laravel 5 上使用 Apache 2.2.15 时遇到问题。我搜索了这个错误,找到了一些 .htaccess 和 httpd.conf 的解决方案,但没有一个是工作,我在尝试访问“public/auth/register”或“public/auth/login”甚至“/home”时收到此错误:

    Not Found

The requested URL /index.php was not found on this server.

这是我的 .htaccess:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
</IfModule>

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

这是我的 httpd.conf

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

唯一有效的页面是 public/index.php

【问题讨论】:

    标签: php apache .htaccess laravel


    【解决方案1】:

    您必须将 apache 指向 public 文件夹:

    <VirtualHost *:80>
      DocumentRoot /var/www/html/public
      <Directory "/var/www/html/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
      </Directory>
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-20
      • 2016-01-18
      • 2017-12-04
      • 1970-01-01
      • 2015-03-28
      • 2015-05-07
      相关资源
      最近更新 更多