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中上面的代碼前;去掉即可
**********************************************************************************************************
Laravel 404錯誤,Laravel根目錄可以訪問,非根目錄就會出現404 頁面找不到的錯誤