gpt4 book ai didi

php - .htaccess 问题 : RewriteBase takes one argument, 每个目录上下文的基本 URL

转载 作者:行者123 更新时间:2023-12-04 18:58:07 25 4
gpt4 key购买 nike

我正在使用 Laravel,在不附加 index.php 的情况下访问我的应用程序部分时遇到问题到网址。在对 SO 进行了一些研究之后,我发现我需要:

  • 激活rewrite_mod ,
  • 设置 AllowOverrideAll

  • 我已经做到了。然而,在完成所有这些之后,出现了一些新问题。首先我无法访问 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

    关于php - .htaccess 问题 : RewriteBase takes one argument, 每个目录上下文的基本 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23407784/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com