Php Laravel 5-主页路线
我有一个路由问题,我无法将Php Laravel 5-主页路线,php,.htaccess,laravel-5,routes,Php,.htaccess,Laravel 5,Routes,我有一个路由问题,我无法将localhost/test/指向我的站点索引页 当我定义一条路线时,如: `Route::get("/",IndexController@index);` localhost/test/可以正常工作,但也可以localhost/test/admin,localhost/test/enlocalhost/test/foolocalhost/test/undefined route并加载我的站点索引页 除此之外,当我有名称空间路由时,如: Route::group(['
localhost/test/
指向我的站点索引页
当我定义一条路线时,如:
`Route::get("/",IndexController@index);`
localhost/test/
可以正常工作,但也可以localhost/test/admin
,localhost/test/en
localhost/test/foo
localhost/test/undefined route
并加载我的站点索引页
除此之外,当我有名称空间路由时,如:
Route::group(['namespace'=>'Admin'],function(){
Route::controller("admin"=>"AdminController");
})
如果我键入localhost/test/foo/admin
一切正常,但当我写入时:
localhost/test/admin
只是我的网站索引页
我不知道这里出了什么问题,路由问题或.htaccess
重定向我的,我不知道
对不起,代码拼错了,我刚刚写了我昨晚记得的东西
注意:我的根目录中有一个索引文件
我的根目录的.htaccess
文件如下所示,我将根目录的server.php
文件替换为我的index.php
文件:
RewriteEngine On
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我的公共目录的.htaccess
文件与默认文件类似。为什么不运行(从终端):
然后在以下位置测试项目,而不是:
或者,如果您正在使用apache,添加新的虚拟主机升级到Laravel 5.3似乎解决了路由问题,我使用apache LogLevel rewrite:trace7对其进行了测试,但我没有得到任何导致此问题的原因,好的,我尝试了,谢谢
php artisan serve