2013-10-17 18 views
0

我安裝了laravel並獲得主頁localhost/laravel/public。 但無法做簡單的路由。Laravel無法加載除家庭以外的其他網址(/)?

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

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

這裏我打電話給localhost/laravel/public/authors上的同一個視圖。 但我得到404

我有也/但與authors

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

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

現在我得到作者的/但與authors查看不同的看法。

感謝

+0

是Apache安裝? ...啓用了mod_rewrite指令? – naththedeveloper

+2

看看'localhost/laravel/public/index.php/authors'是否有效。 – user1669496

+0

它的工作原理'本地主機/ laravel /公/ index.php文件/ authors'加入兩行'RewriteEngine敘述上 RewriteBase後 – Gangaraju

回答

1

如果你能夠訪問​​,那麼你就需要ADDA RewriteBase.htaccess文件,也就是說,假設你運行的是Apache:

RewriteEngine on 
RewriteBase /laravel/public 
<other rules go here> 
+0

仍然沒有工作... .htaccess文件/ laravel /公共 選項+了FollowSymLinks RewriteEngine敘述在 的RewriteCond%{REQUEST_FILENAME}!-f 的RewriteCond%{REQUEST_FILENAME}!-d 重寫規則^(。*)$的index.php/$ 1 [L] ' – Gangaraju