问题描述
我正在使用PHP74在Apache24上运行Laravel 8.0.1
当我创建一个新项目时,欢迎页面呈现良好。如果添加其他路线,我总是会收到404
% composer create-project --prefer-dist laravel/laravel test123
Installing laravel/laravel (v8.0.1)
- Installing laravel/laravel (v8.0.1): Loading from cache
...
...
Package manifest generated successfully.
69 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan key:generate --ansi
Application key set successfully.
%
% cd test123
% chmod a+w storage/logs/ storage/framework/sessions/ storage/framework/views/ bootstrap/cache/
% npm install
% npm run dev
Laravel页面现在可以正常显示。对我来说很好:)
但是,如果我向routes/web.php
添加新路线
Route::get('/about',function () {
return view('welcome');
});
尝试访问/ about上的页面,我会得到一个404
不幸的是,storage/logs/laravel.log
是空的(当我访问/页面时也没有任何条目)
解决方法
ApacheConfiguration在DocumentRoot上具有AllowOverride None
,因此.htaccess无法覆盖内容。将此选项设置为全部(或.htaccess文件中提到的选项)可以达到目的
向lagbox表示正确的方向