Laravel The requested URL /hellowzy was not found on this server. 404 问题的解决
在一个Laravel项目中,新建了一个控制器及方法,路由,然后执行php artisan serve,这个方法是可以访问到的,可是部署到apache环境,根目录指向public目录,就报错了:
Not Found
The requested URL /hellowzy was not found on this server.
nally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
经查deepseek,发现可能是.htaccess的问题,
把.htaccess填充如下内容就ok了:
<IfModule mod_rewrite.c><IfModule mod_negotiation.c>Options -MultiViews -Indexes</IfModule>RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]
</IfModule>