laravel3中的路由无法正常工作

时间:2013-06-27 14:08:20

标签: php laravel

我是Laravel的新蜜蜂。我借助这个tutorial建立了Laravel。我已经设置了虚拟主机,在我写的虚拟主机上。

<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目录中的所有文件列表都会显示。但是当我在它之后输入主页时它会显示“在此服务器上找不到请求的URL / home。”。我在应用程序文件夹中的route.php中编写了这段代码。

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

3 个答案:

答案 0 :(得分:0)

<VirtualHost *:80>
    ServerAdmin postmaster@some_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>

这对我很好,希望能帮到你

答案 1 :(得分: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>
你正在使用符号链接吗?

答案 2 :(得分:-1)

不使用可能不时讨厌的VirtualHosts,为什么不使用PHP 5.4内置开发服务器。

以下是XAMPP localhost returns object not found after installing Laravel

的方式
相关问题