【发布时间】:2015-09-22 12:38:30
【问题描述】:
是的,有类似的问题,但建议的解决方案对我不起作用。 所以我已经设置了 Laravel,并且安装工作正常。 好吧,只要我留在基本路线上
localhost/page/
当我试图到达我的一条路线时,让我们说
localhost/page/subpage
并且路由被配置为返回一个视图
Route::get('subpage', ['as' => 'subpage', 'uses' => 'GenericPageController@subpage']);
Controller中的方法subpage:
public function subpage()
{
return view('base.subpage');
}
每当我尝试访问其中一条路由时,我都会从服务器获得 404 响应。我使用的是什么控制器,或者它是否返回视图或闭包都无关紧要。
- mod_rewrite 已启用
- 在主目录上设置
AllowOverride到All
page/public 文件夹中的.htaccess 如下所示:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
有人知道问题可能是什么吗?
【问题讨论】:
标签: apache .htaccess laravel mod-rewrite