Title: Automatic Domain Changer
Author: nuagelab
Published: <strong>2013 年 4 月 2 日</strong>
Last modified: 2026 年 5 月 8 日

---

搜索插件

![](https://ps.w.org/automatic-domain-changer/assets/banner-772x250.png?rev=732952)

![](https://ps.w.org/automatic-domain-changer/assets/icon-256x256.png?rev=1151255)

# Automatic Domain Changer

 作者：[nuagelab](https://profiles.wordpress.org/nuagelab/)

[下载](https://downloads.wordpress.org/plugin/automatic-domain-changer.3.0.1.zip)

 * [详情](https://cn.wordpress.org/plugins/automatic-domain-changer/#description)
 * [评价](https://cn.wordpress.org/plugins/automatic-domain-changer/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/automatic-domain-changer/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/automatic-domain-changer/#developers)

 [支持](https://wordpress.org/support/plugin/automatic-domain-changer/)

## 描述

This plugin automatically detects a domain name change, and updates all the WordPress
tables in the database to reflect this change.

#### 产品特点

 * Easily migrate a WordPress site from one domain to another
 * Migrate www.domain.com and domain.com at once
 * Migrate http and https links at once

#### 反馈

 * We are open for your suggestions and feedback – Thank you for using or trying
   out one of our plugins!
 * Drop us a line [@nuagelab](http://twitter.com/#!/nuagelab) on Twitter
 * Follow us on [our Facebook page](https://www.facebook.com/pages/NuageLab/150091288388352)
 * Drop us a line at [wordpress-plugins@nuagelab.com](https://cn.wordpress.org/plugins/automatic-domain-changer/wordpress-plugins@nuagelab.com?output_format=md)

### _翻译_

 * 英文
 * 法语
 * 西班牙语
 * 斯洛伐克语

## 屏幕截图

 * [[
 * The domain change and admin notice

## 安装

This section describes how to install the plugin and get it working.

#### 必需条件

 * The PHP CURL extension, usually installed on Un*x, Mac and Windows environments.
   See “Installing CURL on Linux” below for more help.
 * Capability for your server to communicate with the outside work (or more specifically,
   to communicate with our servers)

#### Installing the Plugin

_(using the WordPress Admin Console)_

 1. From your dashboard, click on “Plugins” in the left sidebar
 2. Add a new plugin
 3. Search for “Automatic Domain Changer”
 4. Install “Automatic Domain Changer”
 5. Once Installed, if you want to manually change your domain, go to Tools > Domain
    Change
 6. If your domain changes, a notice will appear at the top of the admin screen with
    a link to the domain changing tool

_(manually via FTP)_

 1. Delete any existing ‘auto-domain-change’ folder from the ‘/wp-content/plugins/’
    directory
 2. Upload the ‘auto-domain-change’ folder to the ‘/wp-content/plugins/’ directory
 3. 通过WordPress的的“Plugins”菜单激活插件
 4. Once Installed, if you want to manually change your domain, go to Tools > Domain
    Change
 5. If your domain changes, a notice will appear at the top of the admin screen with
    a link to the domain changing tool

#### Making your blog/site address automatically reflect your server’s name

Add the following to your wp-config.php file:

    ```
    define('WP_HOME', 'https://' . $_SERVER['SERVER_NAME']);
    define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME']);
    ```

See https://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29
for more information.

## 常见问题

### What does this plugin do precisely?

It scans all the tables with the same table prefix as WordPress. It fetches each
row, unserialize values as needed, and replace the old domain by the new.

### Do you plan to localize this plugin in a near future?

Yes, this plugin will be translated to french shortly. If you want to help with 
translation in other languages, we’ll be happy to hear from you.

## 评价

![](https://secure.gravatar.com/avatar/c130f8fc3f5a4464ca22cb710627273007e34d075fda64e04b110ae62fe0eba3?
s=60&d=retro&r=g)

### 󠀁[A very useful plugin to update the database on domain name change](https://wordpress.org/support/topic/a-very-useful-plugin-to-update-the-database-on-domain-name-change/)󠁿

 [peopleinside](https://profiles.wordpress.org/peopleinside/) 2026 年 6 月 4 日

Thank you for this useful plugin, amazing!Without this is difficult migrate if the
admin are not familiar with direct inside MySQL command.

![](https://secure.gravatar.com/avatar/b04ead96e7a3a102c5883cd1cc70c315d1959e6b9498f3a8367c54912f838923?
s=60&d=retro&r=g)

### 󠀁[great plug in](https://wordpress.org/support/topic/great-plug-in-1237/)󠁿

 [premmarga](https://profiles.wordpress.org/premmarga/) 2022 年 10 月 1 日 1 回复

does what it needs to do use it a lot, for my websites

![](https://secure.gravatar.com/avatar/c50c3b4e7682b812a2a8b2691e61c735d381cbb2e56fe8d644060336e84fd64a?
s=60&d=retro&r=g)

### 󠀁[Does not work](https://wordpress.org/support/topic/does-not-work-863/)󠁿

 [shiftaction](https://profiles.wordpress.org/shiftaction/) 2018 年 1 月 29 日

I cannot get this to work.

![](https://secure.gravatar.com/avatar/b4af88a54810ca4aa95417bba483683b8321880967e26ec15b81a71e10855884?
s=60&d=retro&r=g)

### 󠀁[Does not work w/ Cornerstone Version 2.1.7+ Xtheme Version: 5.2.5](https://wordpress.org/support/topic/does-not-work-w-cornerstone-version-2-1-7-xtheme-version-5-2-5/)󠁿

 [Actor Mike](https://profiles.wordpress.org/websiteworld/) 2017 年 12 月 6 日

Does not work w/ Cornerstone Version 2.1.7+ Xtheme Version: 5.2.5. It worked with
previous versions but doesn’t work anymore. It was fun while it lasted. Maybe the
author will update.

![](https://secure.gravatar.com/avatar/ce59c5153c6fcb4bbc720368cc5f1ffda59c9955cb2af03ff1c8ce30129514e8?
s=60&d=retro&r=g)

### 󠀁[Saved me a lot of time!](https://wordpress.org/support/topic/saved-me-a-lot-of-time-18/)󠁿

 [rickgreen](https://profiles.wordpress.org/rickgreen/) 2017 年 7 月 25 日

Plugin works and it saved me a lot of time. Very thankful for this solution!

![](https://secure.gravatar.com/avatar/fdf15e364b278e7df6491d732f3183447785f58f0a3841392b2bc04ac2f05811?
s=60&d=retro&r=g)

### 󠀁[Not useful with large rules](https://wordpress.org/support/topic/not-useful-with-large-rules/)󠁿

 [hossam hamed](https://profiles.wordpress.org/megatpl/) 2017 年 4 月 25 日 1 回复

Not useful with large rules causing errors with large rules that bypass the 1 GB

 [ 阅读所有29条评价 ](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/)

## 贡献者及开发者

「Automatic Domain Changer」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ nuagelab ](https://profiles.wordpress.org/nuagelab/)

[帮助将「Automatic Domain Changer」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/automatic-domain-changer)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/automatic-domain-changer/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/automatic-domain-changer/)，或通过
[RSS](https://plugins.trac.wordpress.org/log/automatic-domain-changer/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/automatic-domain-changer/)。

## 更新日志

#### 3.0.1

Hotfix for a regression introduced in 3.0.0.

 * Fix: rows whose serialized payload contains a PHP class instance (for example,
   the `_site_transient_update_plugins` transient or any plugin-stored object) were
   being corrupted into `__PHP_Incomplete_Class` after a domain change, which caused
   fatal errors in PHP 8 the next time something tried to mutate a property on those
   objects. The Replacer now leaves such rows byte-identical instead of round-tripping
   them through `unserialize()`. URLs inside class instances are no longer rewritten—
   but they are no longer destroyed either.
 * Fix: no-op short-circuit when the old and new domains match (case-insensitively)
   and no protocol change was requested, so rerunning with the same values cannot
   itself damage the database.
 * Test: add docker smoke-test cases that seed a `stdClass` option and an array 
   containing a `stdClass`, and assert both survive byte-identical.

If you ran 3.0.0 with old == new and now see “incomplete object” fatals (for example
from wp-migrate-db-pro’s update-checker hook), clear the affected transients with`
wp transient delete update_plugins --network` (and `update_themes`, `update_core`)—
they regenerate on the next dashboard load.

#### 3.0.0

Major modernization release. The user-facing behavior is unchanged: the same Tools
Change Domain page with the same options and the same backup buttons. Everything
else has been rewritten.

**Security**

 * Replaced the raw SQL `UPDATE` in the domain-change routine with prepared `$wpdb-
   >update()` calls to eliminate a SQL injection risk on the primary-key value.
 * `unserialize()` is now called with `allowed_classes => false` so a malicious 
   serialized payload in a row cannot trigger PHP object injection while the plugin
   scans the database.
 * Option writes (`auto_domain_change-https`, `auto_domain_change-www`) are now 
   gated behind both nonce verification and an `update_core` capability check. Previously,
   any authenticated `POST` to the admin page could flip them.
 * Dismissing the domain-change admin notice now requires a nonce and the `update_core`
   capability (previously a plain `?dismiss-domain-change=1` GET, vulnerable to 
   CSRF).
 * All `$_POST`, `$_GET`, and `$_SERVER` values are sanitized; `force-protocol` 
   is validated against an allow-list; submitted domains are validated against a
   host-name pattern before being used.
 * Explicit capability checks at the top of the admin page and both backup routines(
   defense in depth).
 * Drops the PHP-4 `&$this` reference style and the manual `pluggable.php` require.

**Compatibility**

 * `Requires PHP: 7.4`, `Requires at least: 5.0`. Older PHP silently ignored `unserialize()`‘
   s `allowed_classes` option, defeating the object-injection guard, so older versions
   are now refused with a clear admin notice.
 * Tested up to WordPress 6.9.4.

**Architecture**

 * Restructured into a PSR-4 layout under `NuageLab\AutoDomainChanger\` with a tiny
   hand-rolled autoloader (no Composer required at runtime).
 * Extracted the admin form to a template, the styles to `assets/css/admin.css`,
   and the click handler to vanilla `assets/js/admin.js` (no jQuery).
 * The serialize/JSON walker (`Domain\Replacer`) is now a self-contained class that
   can be invoked independently of the admin UI.

#### 2.0.2

 * Tested up to WordPress 4.9.8
 * Added a way to change the protocol to HTTP or HTTPS

#### 2.0.1

 * Tested up to WordPress 4.6.1
 * Removed admin notice for users who don’t have update_core permission

#### 2.0.0

 * Tested up to WordPress 4.4.2
 * Added backup functionality
 * Removed usage of mysql_* functions in favor of $wpdb

#### 1.0.1

 * Tested up to WordPress 4.2.2

#### 1.0

 * Tested up to WordPress 4.2.1

#### 0.0.6

 * Bug fix with the processValue function generating a warning (thanks to @sniemetz
   for letting us know about this issue)
 * Slovak translation (thanks to Marek Letko)
 * Tested up to WordPress 4.1.1

#### 0.0.5

 * Minor text change

#### 0.0.4

 * Added JSON detection to fix values not being handled for plugins like RevSlider(
   thanks to Alfred Dagenais for letting us know about this issue)
 * Added double serialize detection for plugins like Global Content Blocks (thanks
   to @pixelkicks for letting us know about this issue)
 * Tested plugin up to WordPress 4.0.0

#### 0.0.3

 * Tested plugin up to WordPress 3.8.0

#### 0.0.2

 * Added error suppression on unserialize calls, as failing unserialize are normal
   and part of the game. Thanks to Kailey Lampert for pointing this out.
 * Added serialize(false) detection.

#### 0.0.1

 * First released version. Tested internally with about 10 sites.

## 额外信息

 *  版本 **3.0.1**
 *  最后更新：**1 月前**
 *  活跃安装数量 **10,000+**
 *  WordPress 版本 ** 5.0 或更高版本 **
 *  已测试的最高版本为 **6.9.4**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/automatic-domain-changer/)
 * 标签
 * [admin](https://cn.wordpress.org/plugins/tags/admin/)[administration](https://cn.wordpress.org/plugins/tags/administration/)
   [domain change](https://cn.wordpress.org/plugins/tags/domain-change/)[links](https://cn.wordpress.org/plugins/tags/links/)
   [migration](https://cn.wordpress.org/plugins/tags/migration/)
 *  [高级视图](https://cn.wordpress.org/plugins/automatic-domain-changer/advanced/)

## 评级

 4.3 星（最高 5 星）。

 *  [  23 条 5 星评价     ](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/?filter=5)
 *  [  1 条 4 星评价     ](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/?filter=4)
 *  [  1 条 3 星评价     ](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/?filter=2)
 *  [  4 条 1 星评价     ](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/automatic-domain-changer/reviews/)

## 贡献者

 *   [ nuagelab ](https://profiles.wordpress.org/nuagelab/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/automatic-domain-changer/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://www.nuagelab.com/products/wordpress-plugins/)