apache - 使 .htaccess 在符号链接目标文件夹中工作
问题描述
我使用 public_hmtl 中的符号链接来访问服务器上其他位置的文件夹中的脚本,但该文件夹有一个 .htaccess 文件,该文件阻止访问,如果我只是删除/禁用它,脚本将无法工作。
符号链接在这里:
/home/username/public_html/symlink
脚本目标文件夹在这里:
/家/目标
有没有办法让 .htaccess 文件在符号链接目标文件夹中工作?还是我应该把它移到别的地方?
我尝试将其添加到 .htaccess 文件中:
Options +FollowSymLinks
但这并没有做任何事情。显然我还必须把它放在 Apache 配置中的某个地方(?):
# enable allowoverride privileges
<Directory /home/target>
AllowOverride Options
</Directory>
但是我的 VPS 配置了 EasyApache4,所以我不应该手动编辑虚拟主机文件和方法以通过 WHM 产生错误来包含这些行。
我应该继续尝试 FollowSymLinks/AllowOverride 吗?或者这无论如何都是一个死胡同?还有其他解决方案吗?
为我的无知道歉。.htaccess 把我搞糊涂了。我不知道这些文件发生了什么。
编辑:
.htaccess 文件有以下几行:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
RewriteRule ^resetPassword$ /index.php?resetPassword=true
RewriteRule ^resetPassword/([^/\.]+)/?$ /index.php?resetPassword=true&hash=$1
RewriteRule ^install$ /index.php?install=true
RewriteRule ^install/([^/\.]+)/?$ /index.php?install=true
RewriteRule ^update /index.php?update=true
RewriteRule ^update/([^/\.]+)/?$ /index.php?update=true
RewriteRule ^/?$ /index.php?act=dashboard.show
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2 [QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3 [QSA]
解决方案
推荐阅读
- python - 在python中检查字符串中的逻辑值
- ios - 依次传递参数
- typescript - 意外的标记; 需要“模块、类、接口、枚举、导入或语句”。在打字稿中
- c# - 在统一编辑器脚本中,如何使用没有特定文件类型的代码编辑器打开资产
- json - 来自 Google 表格的 JSON 数据未正确解析
- kubernetes - 使用 kubectl 挂载卷
- list - 尝试获取最后一个元素时出现 Haskell 错误
- database - 在 Cloudflare 上建立数据库连接时出错
- android - 预期为 BEGIN_ARRAY,但在第 1 行第 26 列路径 $.result 处为 STRING
- windows - Omnikey 5421 通用卡命令接口不适用于 Mifare plus SL1