首页 > 解决方案 > 为什么 Apache(centos 7) 看不到我创建的路由?

问题描述

我做了路由,但是 apache 服务器看不到那个路由。Laravel 欢迎页面没有问题,但是当我尝试在视图中创建另一个文件夹时。Apache 看不到该页面。404 未找到弹出。

这是路线和控制器代码

Route::get('/pages', 'Pages@index');

和控制器

    function index(){
    return "test";

还有我的 httpd 我的文档根目录:/var/www/html/laravel/public

模块目录:DirectoryIndex index.html index.php

我还需要更改其他内容吗?使这条路线可以访问?

标签: laravelapacheroutescentos

解决方案


在 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>

推荐阅读