Laravel 404錯誤,Laravel根目錄可以訪問,非根目錄就會出現404 頁面找不到的錯誤


Laravel根目錄可以訪問 Route::get(‘/‘, ‘HomeController@showWelcome‘);

非根目錄就會出現404 頁面找不到的錯誤,如下

Route::get(‘user‘, ‘UserController@index‘);

解決方法:
首先安裝前

1,php開啟phpopenssl

2,在apache conf開啟rewrite莫塊
模塊(#LoadModule rewrite_module modules/mod_rewrite.so)

3,在conf文件中找到directory 把AllowOverride None 改成 AllowOverride All

<Directory "c:/Apache24/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
4,在laravel項目工程的public目錄下添加.htaccess文件 ,文件內容如下

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

 

 

*************************************************************************************************************

本人安裝時解決方法其它不動

;extension=php_openssl.dll
只需要將php.ini中上面的代碼前;去掉即可

**********************************************************************************************************


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM