[WordPress] 403 forbidden error

本文适用于当你打开自己的WP网站时, 遇到下面的问题: 



打开WP-Content 文件夹, 里面会有这个web.config 文件, 原本是不应该有的.里面的code就是禁止访问这个folder里面的所有的.php文件: 

其实以.php为后缀的文件, 不管里面是什么内容, 都是按照.php来处理的.

  <system.webServer>
    <rewrite>
      <rules>
            <clear />
            <rule name="SQL Injection" stopProcessing="true">
                <match url="^.*\.php.*$"/>             
                <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
            </rule></rules>
    </rewrite>
  </system.webServer>

2> Below is the solution :  

Yes, it shows 403 forbidden error for some requests on your WordPress site. That is because : Due to WordPress always hacked , Our system auto detect and put a web.config file within WP-Content to prevent request .php file in this folder.There are 2 solutions for you:
1> Use other Themes which needn't to call .php file in that way ;
2> Comment the Rewrite rule in WP-Content/web.config file. But please note that by this way , you will need to take care of your site and set the proper permission on your folders. We always suggest you to set your WP folder permissions to read Only to prevent hacking.

3> You can login into server/your computer  , touch in the web.config file in WP-content folder , set the property of this file to read-only.

. . Please remember that : 

是设置文件属性为只读, 不是文件权限. 



HTTP 403 Forbidden错误通常表示服务器收到了请求,但是拒绝执行这个请求。这可能是由于以下几个原因: 1. **权限不足**:你可能试图访问的内容或资源是你没有权限访问的,比如某些页面仅限于特定用户或IP地址。 2. **配置限制**:服务器的`.htaccess`文件(在Apache web服务器中常见)可能设置了访问控制规则,不允许某些路径或URL的访问。 3. **目录锁定**:有时服务器上的某个目录被设置为只读模式,不接受写入或执行操作,这也会导致403 Forbidden。 4. **安全设置**:防火墙或安全软件可能会阻止某些请求,尤其是在云环境中。 在你的案例中[^1],当你遇到403 Forbidden错误时,修改`.htaccess`文件并上传成功解决了问题,这表明可能是文件权限设置不当或者是基于规则的访问控制策略发生了改变。 要解决这类问题,你可以尝试以下步骤: 1. **确认权限**:检查是否有正确的权限访问该资源,可能需要与网站管理员联系以获得必要的访问权限。 2. **查看.htaccess**:查看或理解`.htaccess`文件中关于访问控制的部分,看看是否存在误操作或过时的规则。 3. **清除缓存**:有时候,浏览器缓存也可能导致显示旧的访问权限设置,清空浏览器缓存试试看。 4. **重置服务器设置**:如果上述方法无效,可能需要联系服务器提供商,让他们帮助检查或调整服务器设置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值