过去两周我一直在想这件事。
我试图部署我的laravel 4.2应用程序到我的服务器,但不能通过主页。在我的本地主机上一切正常。
当我点击一个链接,我得到一个404错误。
我已经将httpd.conf文件设置为:AllowOverwride All我也把我的htaccess文件放在公共文件夹。
我routes.php:
Route::get('/', function()
{
return View::make('index');
});
//Contact Page
Route::get('contact', 'ContactController@getContact');
Route::resource('producten','ProductsController');
//Form request:: POST action will trigger to controller
Route::post('contact_request','ContactController@getContactUsForm');
Route::get('info', function()
{
return View::make('info');
});
Route::get('diensten', function()
{
return View::make('diensten');
});
Route::get('tarieven', function()
{
return View::make('tarieven');
});
path .php文件的一部分:
|--------------------------------------------------------------------------
|
| The public path contains the assets for your web application, such as
| your JavaScript and CSS files, and also contains the primary entry
| point for web requests into these applications from the outside.
|
*/
'public' => __DIR__.'/../public',
/*
|--------------------------------------------------------------------------
| Base Path
|--------------------------------------------------------------------------
|
| The base path is the root of the Laravel installation. Most likely you
| will not need to change this value. But, if for some wild reason it
| is necessary you will do so here, just proceed with some caution.
|
htacces文件:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Httpd.conf文件:
User http
Group http
NameVirtualHost *:80
NameVirtualHost *:443
ServerAdmin admin
ServerName *
<VirtualHost _default_:80 _default_:443>
DocumentRoot "/var/services/web/pcvoorne.nl/public"
Include conf/extra/mod_fastcgi.conf
</VirtualHost>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory "/var/services/web">
Options MultiViews FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.htm index.cgi index.php index.php5
</IfModule>
<FilesMatch "^'.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
ErrorLog /run/apache22-error_log
#ErrorLog /dev/null
TraceEnable off
我错过了什么使这个工作?希望你能帮助我:)
抱歉必须确认这一点:是否安装了mod_rewrite ?如果能看到更多关于404错误的细节,那就太好了。你看到'/'上的索引了吗?