Laravel 为什么Apache(centos 7)可以';看不到我走的路线?
我创建了路由,但apache服务器看不到该路由。Laravel欢迎页面没有问题,但当我尝试在视图中创建另一个文件夹时。阿帕奇看不到那一页。404未找到弹出窗口 这是路线和控制器代码Laravel 为什么Apache(centos 7)可以';看不到我走的路线?,laravel,apache,routes,centos,Laravel,Apache,Routes,Centos,我创建了路由,但apache服务器看不到该路由。Laravel欢迎页面没有问题,但当我尝试在视图中创建另一个文件夹时。阿帕奇看不到那一页。404未找到弹出窗口 这是路线和控制器代码 Route::get('/pages', 'Pages@index'); 和控制器 function index(){ return "test"; 还有我的httpd我的文档根:/var/www/html/laravel/public 模块目录: DirectoryIndex.html inde
Route::get('/pages', 'Pages@index');
和控制器
function index(){
return "test";
还有我的httpd我的文档根:/var/www/html/laravel/public
模块目录:
DirectoryIndex.html index.php
我还需要换些别的东西吗?要使此路径可访问?在centos 7中,
None
--to->All
可以使其正常运行
<Directory /var/www/html>
. . .
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None --> All
. . .
</Directory>
. . .
#
#AllowOverride控制可在.htaccess文件中放置的指令。
#它可以是“全部”、“无”或关键字的任意组合:
#选项FileInfo AuthConfig限制
#
允许覆盖无-->全部
. . .
检查mod rewrite,apache主机配置-allowoverride…尝试example.com/index.php/pages
如果它有效,那么您必须启用apache mod rewrite。实际上我正在尝试在mod rewite中找到/etc/httpd/conf/httpd.conf,但没有。我需要自己编写吗?如果是,那么怎么做?只需检查主机配置中的AllowOverride
,并暂时将其设置为All
。。您需要允许.htaccess文件基本上使用mod_rewrite。。。重新启动如果您得到的是Apache 404页面,而不是Laravel 404,则意味着mod_rewrite无法工作。。如果你搜索,你可以找到100个答案来帮助你