I'm not only new to Laravel 4, but new to using frameworks. I thought I'd start with Laravel since it's gotten such good reviews. I've got a good install of Laravel. I go to /l4/public and see the welcome page.

I'm trying to add a route to 路由.php so that when I navigate to /l4/public/articles I get a response.
I get "The requested URL /l4/public/articles was not found on this server." Do I need to run an artisan command to compile the routes? It's probably something easy. Why this message?

路由.php

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

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

推荐答案

Problem is solved by two editing changes in apache's httpd.conf file.

AllowOverride None is default. AllowOverride controls whether .htaccess files are processed.

mod_rewrite is commented out by default.

改变s to make:

改变 1: Activate mod_rewrite by uncommenting it.

改变 2:

改变

AllowOverride None

to

AllowOverride All

Now restart Apache...

Laravel在公用文件夹中提供的默认.htaccess文件指定了一些mod_rewrite规则.由于AllowOverride设置为None,因此未应用这些规则.请务必在更改这些设置后重新启动Apache. 我的配置:Windows XP上的Apache 2.4.6.

似乎AllowOverride更改可能会带来一些安全隐患.如果有人对此有更多信息,我想听听.

Laravel相关问答推荐

LaravelEloquent 的模型如何将值从控制器内部的函数传递到Render()

到查询构建器的MySQL查询

Laravel REST API:如何将数据库列名与参数的另一个名称映射?

如何返回Blade Laravel 中的按钮?

如何在 Laravel 中使用多对一变形关系

LARAVEL 从多个表中获取重复的行

无法在 Laravel 项目中安装 @vitejs/plugin-vue

处理程序类中的错误 - Laravel

需要 Vagrant 环境或目标机器

找不到列:1054字段列表中的未知列0-Laravel-我的代码中的任何地方都没有0列

Laravel 5 - Php artisan语法错误

Eloquent ORM,deleted_at 使用软删除时没有索引

在 php Laravel 5 中创建自定义帮助函数的最佳实践是什么?

当表中不存在列时如何将 paginate() 与 having() 子句一起使用

扩展 Eloquent 的类的构造函数

无法捕获 Carbon 抛出的异常

如何在 Laravel Mix 中将公共路径更改为包含下划线的内容?

使用哪个 Auth::check() 或 Auth::user() - Laravel 5.1?

Laravel binding绑定的用途和目的是什么?

如何让 Laravel 将 View 的Content-Type标头返回为application/javascript?