.htaccess问题:RewriteBase接受一个参数,即每个目录上下文的基本URL


.htaccess issue: RewriteBase takes one argument, the base URL of the per-directory context

我正在使用Laravel,在访问应用程序的某些部分时遇到问题,而没有将index.php附加到URL。在对SO进行了一些研究后,我发现我需要:

  1. 激活CCD_ 2
  2. AllowOverride设置为All

我已经做到了。然而,在做了所有这些之后,出现了一些新的问题。首先,我无法访问public文件夹,并且我得到以下错误(当查看apache2/error.log时(:

 [core:alert] [pid 15557] [client 87.81.146.231:56147] /var/www/data_exchange/laravel/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context

这是.htaccess文件

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine ON
    RewriteBase /laravel/  # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

以下是httpd.conf(apache2.conf(的样子,我想我应该添加一个新目录,看看它是否能解决问题:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

<Directory /var/www/data_exchange/laravel/public>
        Options Indexes followSymlinks
        allowoverride all
        require all granted
</Directory>

理想情况下,我希望用户能够在应用程序中导航,而无需添加index.php.

尝试从行删除注释

RewriteBase /laravel/  # Redirect Trailing Slashes...

其他一切看起来都不错。

netfreehost@FL