Laravel新手 - 路线不起作用

时间:2016-05-05 10:25:16

标签: laravel-5 laravel-routing

我刚从这个系列开始学习Laravel:https://laracasts.com/series/laravel-5-from-scratch/episodes/2

我使用带有Wamp的Windows 10。

我的网站位于:sites / highland.lar

我创建了虚拟主机。

该路线有以下代码:

Route::get('/', function () { return view('welcome'); });

当我去:http :: highland.lar我得到页面:/而不是Welcome.blade.php视图的索引。

我将index.php文件添加到根文件夹进行测试,这个文件工作正常。

安装laravel后,public / htaccess看起来像:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
       Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

阅读此链接:enter link description here 我改成了:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

没有任何帮助。我做错了什么?

1 个答案:

答案 0 :(得分:0)

好的,用这个链接解决了这个问题: enter link description here

相关问题