2013-06-27 213 views
4

我是Laravel的新蜜蜂。我在tutorial的幫助下成立了Laravel。我已經設置了虛擬主機,在我寫的虛擬主機上。laravel3路由不能正常工作

<VirtualHost *:80> 
    ServerName ranjitalaravel.com 
    DocumentRoot "/var/www/html/laravel4/public" 
    <Directory "/var/www/html/laravel4/public"> 
    </Directory> 
</VirtualHost> 

在我的主機文件,即/ etc/hosts中

127.0.0.1 ranjitalaravel.com 

當我在我的瀏覽器中鍵入http://ranjitalaravel.com/我laravel目錄內的文件全部列表顯示。但是當我在它之後鍵入home時,它會顯示「在此服務器上找不到請求的URL/home」。我已將這些代碼寫入應用程序文件夾中的route.php中。

Route::any('home', function() 
{ 
    return View::make('home.index'); 
}); 
+0

您是否在添加虛擬主機配置後重新啓動Apache? – naththedeveloper

+0

你說你的問題laravel3,但目錄說laravel4。你正在使用哪個版本? – Justin

回答

0
<VirtualHost *:80> 
    ServerAdmin [email protected]_server 
    DocumentRoot "E:/xampp/htdocs/some_server" 
    ServerName some_server 
    ServerAlias some_server 
    ErrorLog "logs/some_server.localhost-error.log" 
    CustomLog "logs/some_server.localhost-access.log" combined 
</VirtualHost> 

能正常工作對我來說,希望可以幫助您

+0

我試過這個,但還是不行。 404未找到正在顯示何時我要訪問請求的網址/首頁 –

0

您使用的符號鏈接嘗試此配置

<VirtualHost *:80> 
    ServerName ranjitalaravel.com 
    DocumentRoot /var/www/html/laravel4/public 
    <Directory /var/www/html/laravel4/public/> 
      Options +Indexes +FollowSymLinks +MultiViews 
      AllowOverride all 
      Order allow,deny 
      allow from all 
    </Directory> 
</VirtualHost>