简体   繁体   English

Wordpress 403 禁止错误

[英]Wordpress 403 Forbidden Error

I am having a CRAZY error with Wordpress. When I create a new article or edit an old one, I cannot insert hotfile links that go after the first trailing slash.我遇到了 Wordpress 的疯狂错误。当我创建新文章或编辑旧文章时,我无法在第一个尾部斜杠后插入 go 的热文件链接。

I'm explaining it better.我正在更好地解释它。 If in a post I do:如果在帖子中我这样做:

<a href="http://www.hotfile.com">TEST</a>

I can correctly create the article.我可以正确地创建文章。 If I do:如果我做:

<a href="http://www.hotfile.com/">TEST</a>

Or longer link, like:或更长的链接,例如:

<a href="http://www.hotfile.com/dl/[...]">TEST</a>

I get an instant 403 error when updating the post from administration.从管理更新帖子时,我立即收到 403 错误。 This is crazy, and happens only with Hotfile links.这太疯狂了,而且只发生在 Hotfile 链接上。 Everything else works like a charm.其他一切都像一个魅力。

What could the error be?错误可能是什么? If it helps, i'm posting my .htaccess, that I never changed from my WP installation:如果有帮助,我将发布我的 .htaccess,我从未从我的 WP 安装中更改过:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Already done repairing and optimization of MySQL DB.已修复和优化 MySQL 数据库。 Kind thanks in advance to everyone.在此先感谢大家。

I'm a regular WP developer, and I see little bugs like this all the time. 我是一名普通的WP开发人员,我总是看到这样的小错误。 Unfortunately, it usually means it's time to go through the tedious work of testing. 不幸的是,它通常意味着是时候完成繁琐的测试工作了。 The problem likely lies either with Apache/htaccess, or in a WP plugin or Theme. 问题可能在于Apache / htaccess,或者在WP插件或主题中。

To attempt to eliminate WP as the cause of this specific issue, I'd try creating a php file with the following in it: 为了尝试消除WP作为此特定问题的原因,我尝试创建一个包含以下内容的php文件:

<?
if (isset($_POST["field"]))
    echo $_POST["field"];
?>
<form method='post'>
    <input type='hidden' name='field' value='<a href="http://hotfile.com/dl/">TEST</a>'>
    <input type='submit' value='Test'>
</form>

If clicking "Test" does not result in the same 403 error, then it's something happening with WP specifically. 如果单击“测试”不会导致相同的403错误,那么这是WP专门发生的事情。 If it does result in a 403, then it's a much more annoying problem that you are going to want to take up with your hosting provider. 如果它确实导致了403,那么您将要与托管服务提供商讨论这是一个更烦人的问题。

If it is a WP problem, the first thing I would do is to start deactivating plugins 1 by 1, starting with the plugins I think are the most likely culprits. 如果它是一个WP问题,我要做的第一件事是开始逐个停用插件,从插件开始,我认为最有可能是罪魁祸首。 If I have no reason to suspect one over another, I just disabled them all, 1 at a time. 如果我没有理由怀疑另一个,我只是一次禁用它们。 Once a plugin is disabled, I try to recreate the original issue. 一旦插件被禁用,我会尝试重新创建原始问题。 If the problem still happens, it's obvious that plugin wasn't at fault, and I reactivate it and test the next one. 如果问题仍然存在,很明显插件没有错,我重新启动它并测试下一个。 9 times out of 10, my issue is found this way. 10次​​中有9次,我的问题就是这样找到的。 Be careful when trying this, as some plugins will clear their settings when they're deactivated. 尝试此操作时要小心,因为某些插件会在停用时清除其设置。

If that doesn't solve the issue, I'll try a different theme and see if that fixes it. 如果这不能解决问题,我会尝试不同的主题,看看是否能解决问题。 Obviously if the problem is gone when you try a new theme, you know where your problem is. 显然,如果在尝试新主题时问题消失,您就会知道问题出在哪里。 Again, some themes can have setting associated with them, and changing the theme can lose those settings. 同样,某些主题可能具有与之关联的设置,并且更改主题可能会丢失这些设置。

Finally, check your wp-content/mu-plugins folder for plugins that are always active and don't always show up in your list of plugins. 最后,检查wp-content/mu-plugins文件夹中的插件是否始终处于活动状态,并且不会始终显示在插件列表中。

I also had a similar issue, apparently wordpress has some problems with some bits of code I tried to add in my post. 我也有一个类似的问题,显然wordpress在我试图在我的帖子中添加的一些代码有一些问题。 I managed to bypass the issue by surrounding the code in <pre> tags. 我设法通过包围<pre>标签中的代码来绕过这个问题。

I realize this post is as ancient as time itself but I've run into a similar problem took me forever to figure out what was going on until i realized all I had to do is add: 我意识到这篇文章与时间本身一样古老,但我遇到了类似的问题,让我永远想知道发生了什么,直到我意识到我所要做的就是添加:

Options +FollowSymLinks

At the top of the .htaccess file and presto! 在.htaccess文件的顶部和presto! It worked. 有效。

Options +FollowSymLinks
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Credit goes to this good man: http://www.coolestguyplanettech.com/403-forbidden-error-wordpress-htaccess/ 归功于这位好人: http //www.coolestguyplanettech.com/403-forbidden-error-wordpress-htaccess/

Mostly, 403 forbidden error is because of four reasons 1. File permission.大多数情况下,403 forbidden 错误是由于四个原因 1. 文件权限。 2. Issue with plugins. 2. 插件问题。 3. Hotlink protection 4. issue with .htaccess file 5. Your CDN(Content Delivery Network). 3. 防盗链 4. 发布 .htaccess 文件 5. 你的 CDN(内容分发网络)。 For solving this error you need to check all these aspects to remove the error.要解决此错误,您需要检查所有这些方面以消除错误。

  1. check the file permission as you know the file has permission for 644 and the directory 755检查文件权限,因为您知道该文件具有 644 和目录 755 的权限
  2. Deactivate the plugins.停用插件。 Sometimes you might get errors because of plugins有时你可能会因为插件而出错
  3. next you need to delete .htaccess file and create a new file with the below code接下来您需要删除 .htaccess 文件并使用以下代码创建一个新文件
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
  1. Next you need to check hotlink protection for your site.接下来,您需要检查您网站的热链接保护。 As it proved your website to link media or files from other sites.因为它证明了您的网站可以链接来自其他网站的媒体或文件。
  2. lastly, you need to check for CDN you can disable it to know if it causing error or not.最后,您需要检查 CDN,您可以禁用它以了解它是否会导致错误。

I know my answer is late in coming but just wanted to add my 2 cents. 我知道我的回答是迟到的,但只是想增加2美分。

  1. I would recommend checking the .htaccess file to make sure it is similar to below. 我建议检查.htaccess文件以确保它类似于下面。

     # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress 
  2. You could try adding Options +FollowSymLinks as adamj stated in his answer so the .htaccess would look similar to below. 您可以尝试添加Options +FollowSymLinks作为adamj在他的回答中说明,所以.htaccess看起来类似于下面。

     Options +FollowSymLinks # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress 
  3. Check to ensure that no plugin are causing the issue. 检查以确保没有插件导致问题。 Disable all plugins to see if the issue persist. 禁用所有插件以查看问题是否仍然存在。 If it doesnt, it would be a process of elimination to figure out which one is the cause. 如果它没有,那将是一个消除的过程,以找出哪一个是原因。

  4. Finally, I have removed the .htaccess file and that also worked for me but no .htaccess file would means no URL rewrite unless your web server is otherwise configured. 最后,我删除了.htaccess文件,这也对我有用,但没有.htaccess文件意味着没有URL重写,除非您的Web服务器另外配置。

I hope this helps someone. 我希望这可以帮助别人。

Delete .htaccess files from all folders.从所有文件夹中删除.htaccess文件。 Solved .解决了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM