如何使用Laravel 4在服务器上配置.htaccess


How to configure .htaccess on server using Laravel 4

我的.htaccess文件有问题,我想这就是问题的全部。当我试图在屏幕上运行我的网站时,显示错误:

警告:require(DIR/bootstrap/autoload.php)[function.request]:无法打开流:第行/index.php中没有这样的文件或目录21

警告:require_one(DIR/bootstrap/start.php)[function.requestonce]:无法打开流:没有这样的文件或第35行/index.php中的目录

致命错误:require_once()[function.request]:打开失败必需的'DIR/bootstrap/start.php'(include_path='.:/:/usr/local/php/pear5')在第35行的/index.php中

我找到了一些解决方案,但不起作用。这是我的.htaccess文件:

 # Use PHP 5.3
 AddHandler application/x-httpd-php53 .php
<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>

我的服务器上的php版本是5.3

请帮忙。

我认为这会奏效。在index.php文件中配置

require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';

而不是

require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';

并且在bootstrap/paths.php中改变

'public' => __DIR__.'/../public',

'public' => __DIR__.'/../',