【发布时间】:2017-10-01 13:17:58
【问题描述】:
我是 Silex Framework 的新手,但我遇到了 url 重写的问题。
问题:
当我在浏览器中输入这个 -> http://localhost/mysite/ 它正在工作并加载索引视图。
$app->get('/', function() use($app) {
return $app['twig']->render('index.twig.html');
});
但是当我输入http://localhost/mysite/about
$app->get('/about', function() use($app)
{
return $app['twig']->render('about.twig.html');
});
它给了我以下错误:The requested URL http://localhost/mysite/about was not found on this server.
如果我输入这个网址http://localhost/mysite/index.php/about
这个网址有效,我不明白为什么?我需要在没有这个 index.php 的 url 中加载这个视图。我该怎么做?提前致谢。
【问题讨论】:
标签: url-rewriting silex