当我与#34; php artisan serve"它运行完美,但是当我使用apache服务时,HTTP请求会给我404错误。
这是控制台给我的: 无法加载资源:服务器响应状态为404(未找到)
routes.php文件
Route::get('/', function()
{
return View::make('index');
});
Route::group(array('prefix' => 'api'), function() {
Route::resource('comments', 'CommentsController',
array('only' => array('index', 'store', 'show', 'destroy')));
});
App::missing(function($exception)
{
return View::make('index');
});
htaccess的:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
apache2.conf:
<Directory /var/www/app/public/>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
在sites-available / 000-default.conf中添加了一行:
DocumentRoot /var/www/app/public/
我正在关注本教程: http://scotch.io/tutorials/php/create-a-laravel-and-angular-single-page-comment-application