2016-04-04 23 views
0

仮想ホストでの処理Laravelルートが正常に動作していないため、public/index.phpにアクセスできますが、ルーティングは有効ではありません。仮想ホストがlaravelで動作していない5.1

<VirtualHost *:80> 
    ServerName laravel.dev 
    ServerAdmin [email protected] 
    DocumentRoot /var/www/mylaravel/public/ 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
    <Directory /> 
     Options FollowSymLinks 
     AllowOverride All 
    </Directory> 

    <Directory /var/www/mylaravel/public/> 
     Options +Indexes +FollowSymLinks +MultiViews 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

この設定後、特定のルートの結果を取得する代わりに、404エラーの通常のphpスタイルを表示します。

答えて

0

Webサーバー(Apache)をパブリックディレクトリにする必要がありますが、URLとルートにpublicindex.phpを使用する必要はありません。

正しいルートは以下のとおりです。無効にApacheの

Route::get('foo/bar', function() { 
    return 'Hello World'; 
}); 

Route::get('/', function() { 
    return 'It's the index page!'; 
}); 

https://laravel.com/docs/5.1/routing#basic-routing

0

は、あなたがこの方法このproblem.Byを得ているmod_rewite、私はより多くのために私の問題

//keep this in /etc/apache2/sites-available/000-default.conf file 
<Directory /var/www/> 
Options Indexes FollowSymLinks MultiViews 
AllowOverride All 
Order allow,deny 
allow from all 
</Directory> 

//enable mod rewrite 
a2enmod rewrite 

//restart apache 
service apache2 restart 

を解決http://www.kingpabel.com/apache-mod-rewrite/

関連する問題