【问题标题】:Change subdomain URL without moving files在不移动文件的情况下更改子域 URL
【发布时间】:2021-09-13 20:28:26
【问题描述】:

我无法解决问题,我需要在 URL mywebsite.com/subdomain 中“移动”子域 URL subdomain.mywebsite.com。 子域在一个单独的数据库中。

我做了什么:

  • 使用 wp-config.php 更改了 WordPress 站点 URL 更改了 WordPress

  • 使用 phpMyAdmin 在数据库中的站点 URL

  • 保存了 Wordpress 永久链接

  • 在“我的网站”根目录下创建了一个名为“子域”的文件夹

  • 复制修改'mywebsite'根目录下'subdomain'文件夹下的index.php

    /** 加载 WordPress 环境和模板 */ require( dirname( FILE ) . '/subdomain/wp-blog-header.php' );

结果:URL 已更改,但我有一个空白页面。

有人知道我是否犯了错误吗?

【问题讨论】:

  • “空白页”可能意味着您应该首先启用正确的 PHP 错误报告,分别。检查错误日志。
  • 你“在”subdomain/index.php,所以dirname( __FILE__ ) 将返回subdomain——你将/subdomain/wp-blog-header.php 附加到它上面,所以现在需要寻找一个文件subdomain/subdomain/wp-blog-header.php。我猜这实际上并不存在......?
  • 谢谢,我找到了这个 AH00124:由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,使用“LimitInternalRecursion”增加限制。使用“LogLevel debug”获取回溯。现在我正在检查我的 htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /subdomain/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /subdomain/index.php [L] </IfModule>
  • @CBroe subdomain/subdomain/wp-blog-header.php 不存在。我真的不明白/subdomain/wp-blog-header.php 是否与根目录中的“主”文件夹或新的“子域”文件夹有关。我不明白我必须在那里写什么。
  • 我会将第二个站点的完整 WP 安装移动到子域文件夹中。然后您将不得不修改主系统的 .htaccess,以便它允许所有对 /subdomain/ 的请求和下面的路径未经修改地通过。

标签: php mysql database wordpress


【解决方案1】:

你尝试过 wp-config.php 中的 debug true 吗?

【讨论】:

  • 刚刚,我已经在 /srv/www/w 中弃用了 _function() ......plugins/revslider/includes/framework/functions-wordpress.class.php 在线258
  • 没什么变化,空白页。我怀疑'require(dirname(FILE).'/subdomain/wp-blog-header.php');'
  • 明天我会打电话给我的主机。
猜你喜欢
  • 2011-12-12
  • 1970-01-01
  • 2013-08-11
  • 1970-01-01
  • 2018-10-27
  • 2017-08-13
  • 1970-01-01
  • 1970-01-01
  • 2020-12-28
相关资源
最近更新 更多