
wordpress 重定向
Running a self hosted WordPress.org site has a lot of benefits, but at times some easily solveable errors can irritate beginners. White screen of death, Internal server error, and some other common WordPress errors can be really stressing for new users. Recently a user pointed our attention to ‘Too Many Redirects’ error in WordPress. It is a common issue that WordPress users may come across. In this article, we will show you how to fix error too many redirects issue in WordPress.
运行一个自托管的WordPress.org网站有很多好处,但是有时一些容易解决的错误会激怒初学者。 白屏死机 , 内部服务器错误以及其他一些常见的WordPress错误可能确实给新用户带来了压力。 最近,一个用户指出了我们对WordPress中“太多重定向”错误的关注。 WordPress用户可能会遇到一个常见问题。 在本文中,我们将向您展示如何解决WordPress中过多的重定向问题。
On Firefox, this error will be displayed like this:
在Firefox上,此错误将显示如下:
“The page isn’t redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”
“页面无法正确重定向。 Firefox已检测到服务器正在以永远无法完成的方式重定向对该地址的请求。”

为什么我在WordPress中出现太多重定向错误? (Why I am Getting Error Too Many Redirects in WordPress?)
This error usually occurs due to a misconfigured redirection issue. As you know that WordPress has SEO friendly URL Structure which uses the redirect function. Several other popular WordPress plugins also use the redirect functionality. For example, WordPress SEO plugin allows you to remove category base from category URLs by redirecting users to a URL without category base. WordPress SSL and cache plugins also use redirects.
通常由于配置错误的重定向问题而发生此错误。 如您所知WordPress具有使用重定向功能的SEO友好URL结构 。 其他一些流行的WordPress插件也使用重定向功能。 例如, WordPress SEO插件允许您将用户重定向到没有类别库的URL,从而从类别URL中删除类别库。 WordPress SSL和缓存插件也使用重定向。
Due to a misconfiguration in any of these redirection tools, your site may end up redirecting users to a URL that is actually redirecting them back to the referring URL. In that case the user’s browser is trapped between two pages and hence you see the error.
由于这些重定向工具中的任何一个配置不正确,您的网站最终可能会将用户重定向到一个URL,而该URL实际上是将用户重定向回引用URL。 在这种情况下,用户的浏览器被困在两个页面之间,因此您会看到错误。

影片教学 (Video Tutorial)
If you don’t like the video or need more instructions, then continue reading.
如果您不喜欢该视频或需要更多说明,请继续阅读。
如何解决WordPress中的太多重定向错误? (How to Solve Too Many Redirects Error in WordPress?)
The most common misconfiguration that we have come across repeatedly is when a user has incorrect URL in WordPress Address URL or Site Address URL settings.
我们反复遇到的最常见的错误配置是当用户在WordPress地址URL或站点地址URL设置中使用不正确的URL时。

For example, lets assume that your site’s url is http://www.example.com
and you go to Settings » General and set it to http://example.com
. Most web hosts allow you to choose whether you would like to add a www prefix to your domain name or have it without www. In case you had selected to add www to your URL, then adding http://example.com in your WordPress settings will cause the error. Or if you opted to use your domain without www prefix, then adding it with www prefix in WordPress settings will cause this error.
例如,假设您的网站网址为http://www.example.com
然后转到“设置”»“常规”并将其设置为http://example.com
。 大多数网络托管服务商允许您选择是要在域名中添加www前缀还是让其不包含www。 如果您选择将www添加到您的URL,然后在WordPress设置中添加http://example.com将导致错误。 或者,如果您选择使用不带www前缀的域名,那么在WordPress设置中添加带有www前缀的域名将导致此错误。
When a user will come to http://example.com
, they will be redirected by your server’s configuration to http://www.example.com where they will be redirected back to http://example.com
by WordPress because that’s what you have set up in the settings.
当用户访问http://example.com
,他们将通过服务器的配置重定向到http://www.example.com,在此他们将通过WordPress重定向回http://example.com
,因为您在设置中设置的内容。
If your site was working fine, and you you did not make any changes to those settings. Then you need to contact your web host, because it is most probably a configuration issue at their end.
如果您的网站运行正常,并且您没有对这些设置进行任何更改。 然后,您需要联系您的Web主机,因为这很可能是其末尾的配置问题。
However, if you do not have a reliable WordPress hosting provider, and they deny having any issues and/or refuse to help you, then you should consider switching web hosts or fix it yourself.
但是,如果您没有可靠的WordPress托管服务提供商,并且他们拒绝遇到任何问题和/或拒绝为您提供帮助,那么您应该考虑切换网络托管服务商或自行修复。
To fix this, you need to change your WordPress Address and Site Address. Go to Settings » General, change your WordPress and Site Address. If you have your address with www prefix, then change it to non-www URL, and if you have it with non-www URL then add the www prefix.
要解决此问题,您需要更改WordPress地址和站点地址。 转到“设置”»“常规” ,更改您的WordPress和站点地址。 如果您的地址带有www前缀,则将其更改为非www URL,如果您的地址带有非www URL,则添加www前缀。
Important: Make sure that you don’t leave a trailing slash at the end of your URL like http://www.example.com/
重要提示 :请确保不要在网址末尾(例如http://www.example.com/
后留下斜线
更改网站URL而无权访问管理区域 (Change Site URL Without Access to Admin Area)
In case you don’t have access to WordPress Admin area, you can still update these settings by defining them in wp-config.php file. Simply connect to your website using an FTP client. Once you are connected to your site, you will find wp-config.php file in your site’s root directory. You need to download and edit this file using a text editor like Notepad. Simply add these two lines to the file and don’t forget to replace example.com with your own domain.
如果您无权访问WordPress Admin区域,则仍可以通过在wp-config.php文件中定义它们来更新这些设置。 只需使用FTP客户端连接到您的网站。 连接到站点后,您将在站点的根目录中找到wp-config.php文件。 您需要使用文本编辑器(如记事本)下载和编辑此文件。 只需将这两行添加到文件中,别忘了用您自己的域替换example.com。
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Save the file and upload it back to your web server. Now try to access your WordPress site. If you still can not access your site, then try to add your domain with www prefix.
保存文件并将其上传回Web服务器。 现在尝试访问您的WordPress网站。 如果仍然无法访问您的站点,请尝试添加带有www前缀的域。
解决其他重定向问题 (Fixing Other Redirect Issues)
If the previous step did not solve your problem, then it is likely that there is a plugin issue with your site. As we mentioned earlier that several WordPress plugins use redirection techniques to do a variety of things. We will try to help you troubleshoot.
如果上一步没有解决您的问题,则您的网站可能存在插件问题。 正如我们前面提到的,几个WordPress插件使用重定向技术来做各种事情。 我们将尽力帮助您进行故障排除。
First you need to figure out is which plugin is causing the issue. Did you activate a new plugin recently right before this error happened? Did you update plugins right before this error happened? If the answer to any of the above questions is YES, then it narrows the problem down to that plugin. You can simply deactivate that plugin by deleting that plugin’s folder from wp-content/plugins/
首先,您需要确定是哪个插件导致了该问题。 您是否刚刚在发生此错误之前激活了一个新插件? 您是否在发生此错误之前更新了插件? 如果以上任何一个问题的答案为是,那么它将问题缩小到该插件。 您可以通过从wp-content / plugins /中删除该插件的文件夹来简单地停用该插件
If you do not know which plugin is causing the issue, then you would need to do some trial and error. The quickest way to do this is by deactivating all plugins. After deactivation of all plugins on your site, you need to use FTP to download the .htaccess file as a backup. You can find this file in your site’s root directory. Once you have downloaded the file, delete it from your server. Now try to access your site.
如果您不知道哪个插件引起了问题,则需要进行一些反复试验。 最快的方法是停用所有插件 。 停用站点上的所有插件后,您需要使用FTP下载.htaccess文件作为备份。 您可以在网站的根目录中找到此文件。 下载文件后,将其从服务器中删除。 现在尝试访问您的网站。
This process will allow your server to regenerate a new .htaccess file, and since there are no plugins activated, it will most likely fix the issue. If the error is gone now, then you know for certain that it was a plugin causing this error.
此过程将使您的服务器重新生成新的.htaccess文件,并且由于未激活任何插件,因此很可能会解决此问题。 如果错误现在消失了,那么您可以肯定地知道它是导致此错误的插件。
The next step is to find out which plugin was the culprit. To do this, you need to download and install fresh copies of all your plugins. Activate plugins one at a time and after activating each plugin try to browse several pages on your site using a different browser as a non-logged in user. Hopefully you will find the plugin that caused the issue.
下一步是找出哪个插件是罪魁祸首。 为此,您需要下载并安装所有插件的新副本。 一次激活一个插件,然后在激活每个插件后,尝试使用其他浏览器作为非登录用户浏览站点上的多个页面。 希望您会找到引起该问题的插件。
These are all the possible solutions that may fix this “error too many redirects issue” in WordPress. Did any of the above solutions fixed the problem for you? If so, then please let us know in the comments. Have you encountered the error too many redirects issue in the past? how did you fix it? If you know a fix that is not listed in the article above, then please contribute in the comments below. We will make sure to keep the article up to date with any new advice from our users.
这些都是解决WordPress中“错误太多重定向问题”的可能解决方案。 以上任何解决方案都可以为您解决问题吗? 如果是这样,请在评论中告知我们。 过去是否遇到错误太多重定向问题? 你怎么修好它的? 如果您知道上面的文章中未列出的修复程序,请在下面的评论中提供帮助。 我们将确保根据用户的任何新建议使文章保持最新。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-fix-error-too-many-redirects-issue-in-wordpress/
wordpress 重定向