douqiu0351 2014-05-01 12:35
浏览 67

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

I am using Laravel, and have a problem with accessing parts of my app without appending index.php to the URL. After some research on SO, I gathered that I needed to:

  1. Activate rewrite_mod,
  2. Set AllowOverride to All

Which I have done. Yet after doing all of this, a couple of new problems arise. First I can't get access to the public folder, and I get the following error (when looking into 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

Here's the .htaccess file

<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>

Here's what the httpd.conf (apache2.conf) looks like, I thought I'd add a new directory to see if it would fix the problem:

<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>

Ideally, I want users to be able to navigate through the app without the need of adding the index.php.

  • 写回答

1条回答 默认 最新

  • douhuan5073 2014-05-02 10:41
    关注

    try removing comment from line

    RewriteBase /laravel/  # Redirect Trailing Slashes...
    

    Everything else looks good.

    netfreehost @ FL

    评论

报告相同问题?

悬赏问题

  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表