Pretty URLs
Apache
The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.
If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
nginx的設定問題,你這種情況應該是看一下你的nginx的server模組 index 有沒有index.php , 然後再看下nginx有沒有設定處理PHP檔案的php-fpm
詳細參考:
https://laravel.com/docs/5.1
首先你看看你是否是透過HTTP協定進行存取的,出現這種情況一般都是透過file:協定進行存取出現的現象。
謝謝各位回答,的確是伺服器這邊的問題,Gundy的答案是Nginx的處理方法.我的是apache伺服器,下面這段是百度的結果
Apache目錄下,有一個conf目錄,打開裡面的"httpd .conf"檔,找到DirectoryIndex 這段.把它改成DirectoryIndex index.php index.Html index.html 這樣,你的網站目錄的預設首頁是index.php, 如果沒有index.php系統會自動尋找index.html 、html做為預設首頁了。