猿问

laravel路由不生效,404,除了/ 都不行

一个路由

首页没问题,改也没问题


Route::get('/', function () {
    return view("welcome");//可以
});

Route::get('/about', function () {
    return 'about';//如上图404
});

phpstudy 搭建(5.5.38)

https://img2.mukewang.com/5c8f56d20001301b05120132.jpg

这个照搜的教程也打开了

配置:

https://img1.mukewang.com/5c8f56d300018de203700218.jpg

https://img4.mukewang.com/5c8f56d40001cbb504630184.jpg

命令行

https://img1.mukewang.com/5c8f56d5000176f005320164.jpg

laravel中public

https://img2.mukewang.com/5c8f56d6000151d104460221.jpg

麻烦大佬,得空给看看了~_~

慕无忌1623718
浏览 1288回答 2
2回答

潇潇雨雨

<VirtualHost *:555> DocumentRoot "D:\phpStudy\WWW\laravel\public" ServerName localhost ServerAlias localhost <Directory "D:phpStudyWWWlaravelpublic"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory></VirtualHost> 配置中指向public

千万里不及你

应该还是rewrite规则没写好,apache:开启mod_rewrite模块,nginx请参考:laravel在nginx的rewrite
随时随地看视频慕课网APP
我要回答