拉拉威尔赢了';t路由,主目录除外


Laravel won't route except home directory

我有一个全新的安装,几乎没有任何更改,它不会接受任何新的路由。我对虚拟主机文件做了很多尝试,主要是在其他网站上发现的,但都没有成功。

我可以获得默认路线,但没有其他路线。

所以这是有效的:

Route::get('/', function()
{
    return View::make('hello');
});

但这不是:

Route::get('test', function()
{
    return 'Hello;
});

现在我有一个apache的conf文件,看起来像:

<VirtualHost *:80>
#Host Name
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com
DocumentRoot /path/to/our/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /path/to/our/public>
    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
</Directory>
</VirtualHost>

我访问网站没有问题,它加载了,我从laravel获得了欢迎页面,但我不能做任何其他路由或任何事情。权限都可以,我可以将此路由更改为任何我想要的。

我通过更改/var/www in my /etc/apache2/apache2.conf文件规则上的AllowOverride使其工作。

原件:

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride none
  Require all granted
</Directory>

新增:

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

我能够通过以下问题注释中的主题来修复错误。

最常见的是这个关于.haccess文件中ReWrite引擎属性的链接,以及这个关于更改httpd.conf文件的链接(我的Apaache/Uubuntu系统上的apache2.conf)。