【问题标题】:403 Error when redirecting with htaccess使用 htaccess 重定向时出现 403 错误
【发布时间】:2018-03-29 17:13:57
【问题描述】:

我的网站上有一个名为/ftp 的目录,我在服务器上安装了net2ftp,这样我就可以更轻松地从任何地方访问我网站的文件。我遇到的问题是我正在尝试将 htaccess 重定向到 /ftp/index.php

DirectoryIndex /index.php

但是,当我转到 /ftp 时,它会拍摄 403 Forbidden Error。我将通向它的所有目录修改为 777 以及 /ftp.htaccess 文件(在 //ftp 中),它仍然有 403 错误。奇怪的是,当我手动输入 /ftp/index.php 时,它会显示 ftp 客户端的登录页面。

如果有人能提供帮助,将不胜感激。

【问题讨论】:

  • 尝试删除正斜杠。请改用DirectoryIndex index.php。另外,请确保在 Apache 配置文件中启用了 .htaccess。
  • 我修好了,没关系。很抱歉浪费您的时间。

标签: php apache .htaccess ftp chmod


【解决方案1】:

我将我的 .htaccess 更改为这个,现在它可以工作了:

DirectoryIndex index.php

RewriteEngine On
RewriteBase /ftp

ErrorDocument 404 /404.php
ErrorDocument 403 /403.php

Order allow,deny
Allow from all
Require all granted

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-23
    • 1970-01-01
    • 2014-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多