Home  >  Article  >  Backend Development  >  如何移动Wordpress目录?

如何移动Wordpress目录?

WBOY
WBOYOriginal
2016-06-06 20:37:121056browse

在 abc.com 域名下建了一个Wordpress站,在abc.com/def 下也建了一个Wordpress站。
现在想把abc.com/def 移动到 abc.com 下作为主站,即打开 abc.com后访问的是原 abc.com/def 下的内容。
请教如何操作?

回复内容:

在 abc.com 域名下建了一个Wordpress站,在abc.com/def 下也建了一个Wordpress站。
现在想把abc.com/def 移动到 abc.com 下作为主站,即打开 abc.com后访问的是原 abc.com/def 下的内容。
请教如何操作?

只需移动一个文件:

  1. 把 def 目录下的 index.php 移到根目录下,即 abc.com 访问到的目录,并确保打开 abc.com 就是打开index.php,而不是index.html;
  2. 将根目录下的 index.php 中的:
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    改成:
    require('./def/wp-blog-header.php');
  3. 在 def/wp-config.php 中添加以下代码:

    define('WP_HOME', 'http://abc.com');
    define('WP_SITEURL', 'http://abc.com/def');

    define('COOKIE_DOMAIN', 'abc.com');
    define('WP_CONTENT_URL', 'http://abc.com/def/wp-content');
    define('WP_PLUGIN_URL', 'http://abc.com/def/wp-content/plugins');

  1. 吧所有文件移动到webroot下面
  2. 修改.htaccess
  3. 修改db url记录
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn