【问题标题】:.Htaccess not redirecting to a subfolder in www.Htaccess 未重定向到 www 中的子文件夹
【发布时间】:2018-03-05 02:09:39
【问题描述】:
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /reminder-app/

#Prevent Indexing
Options +FollowSymLinks -Indexes

#Handle Controller

RewriteCond ${REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /reminder-app/index.php [R=301, L]
</IfModule>

我正在尝试将我的 localhost / 重定向到一个名为提醒应用程序的子文件夹 我将 .htaccess 放在 www 中,这是我的代码。我错过了什么,因为它显示错误:

服务器错误!服务器遇到内部错误,无法 完成您的请求。要么服务器超载,要么存在 CGI 脚本中的错误。

如果您认为这是服务器错误,请联系网站管理员。

错误 500 localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.1

【问题讨论】:

  • 你试过不使用 RewriteBase 吗?正如你的意思,这有点不同。

标签: .htaccess


【解决方案1】:

替换此行RewriteCond ${REQUEST_FILENAME} !-f
有了这个RewriteCond %{REQUEST_FILENAME} !-f 所以,不要在像{REQUEST_FILENAME} 这样的服务器变量前面使用$,而是使用%

那么这个[R=301, L]应该是这样的[R=301,L],L之间没有空格

清除浏览器缓存然后测试它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 2011-03-20
    • 2014-05-26
    相关资源
    最近更新 更多