wamp環境404 Not Found 無法訪問laravel自定義路由 The requested URL was not found on this server.

tips:如果本文對你有用,請愛心點個贊,提高排名,讓這篇文章幫助更多的人。謝謝大家!比心❤~
如果解決不了,可以在文末加我微信,進羣交流,一起交流學習!

問題場景

在新安裝的laravel6.2中,發現除了框架內置的根目錄路由,其他自定的路由全部都訪問不到,頁面提示404.
我定義的路由爲

Route::get('/user', function(){
    return 'hello word';
});

在這裏插入圖片描述

解決方法

打開apache的配置文件httpd.conf,修改如下配置文件,重新啓動服務器即可。

開啓mod_rewrite模塊,刪除掉前面的 # 。

LoadModule rewrite_module modules/mod_rewrite.so

搜索Options Indexes FollowSymLinks,把AllowOverride值改成all

<Directory "E:\wamp64\www\project">
    # AllowOverride none
    AllowOverride all
    # Require all denied
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

歡迎大家加我微信mengyilingjian,拉你進羣一起探討學習。
在這裏插入圖片描述在這裏插入圖片描述

發佈了30 篇原創文章 · 獲贊 81 · 訪問量 14萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章