wordpress 网站在本地工作但不在域中工作

wordpress site working locally but not from the domain

我的 wordpress 网站在我的 wamp 服务器上本地运行,它托管在 ec2 实例上,域在路由 53\cloudfare 中维护。当我使用 mxtoolbox 检查它时,该域正在工作。在我更改服务器中的主机文件之前,该站点一直在运行和运行。我删除了主机文件条目,不小心以为它是一个开发站点,但是我恢复了它,但该站点仍然无法正常工作,我只收到 "TOO MANY REDIRECTS" 错误。以下是当前windows个主机文件详情

#
127.0.0.1 localhost
::1 localhost

127.0.0.1 mydomain.com
::1 mydomain.com

我多次重新启动服务器和 WAMP,但它不起作用。

以下是我的虚拟主机配置

# Virtual Hosts
#

<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride all
    Require all granted
  </Directory>
</VirtualHost>


#
<VirtualHost *:80>
    ServerName mydomain.com
    DocumentRoot "c:/wamp/www/sitefolder"
    <Directory  "c:/wamp/www/sitefolder/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName www.mydomain.com
    DocumentRoot "c:/wamp/www/sitefolder"
    <Directory  "c:/wamp/www/sitefolder/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>`

先清理缓存和浏览器历史记录,然后尝试执行以下操作:

打开您的 wordpress 管理面板 --> 设置 --> 常规 --> 确保它指向正确的域。 --> 保存


或转到wp-config.php文件(如果第一种方法失败/无法访问,请尝试此操作) 添加:

define('WP_HOME','http://YourDomain.com');

define('WP_SITEURL','http://YourDomain.com');

或 尝试删除或重命名默认的 .htaccess


或 尝试禁用插件(重命名 "wp-content/plugin/plugin-folder-name" 中的插件文件夹将使该插件处于非活动状态。如果限制是由于插件引起的,这可能会解决问题)

这是我解决ERR_TOO_MANY_REDIRECTS问题的多种方法。祝你好运