أهم النقاط
- Use a serialisation-safe search and replace for URLs.
- 301-redirect every old URL to the same path on the new domain.
- Use Search Console’s Change of address tool.
Moving WordPress to a new domain means updating where WordPress thinks it lives, every stored link, and redirecting the old address.
1. Back up
Download your files and database before starting.
2. Point the new domain at the site
Add the new domain to your hosting (as the main domain, an addon or by changing the document root) and make sure it has SSL.
3. Replace URLs in the database
WordPress stores full URLs in posts, settings and widgets — some in serialised form, so a plain text replace can break them. Use WP-CLI or a dedicated search-and-replace plugin:
wp search-replace 'https://old-example.com' 'https://new-example.com' --skip-columns=guid --dry-run
wp search-replace 'https://old-example.com' 'https://new-example.com' --skip-columns=guid
This also updates WordPress Address and Site Address.
4. Redirect the old domain
Keep the old domain and send every URL to the same path on the new one with a 301 redirect, so links and search rankings follow.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-example\.com$ [NC]
RewriteRule ^(.*)$ https://new-example.com/$1 [R=301,L]
5. Tell search engines
In Google Search Console, verify the new domain and use the Change of address tool from the old property. Submit the new sitemap.
6. Check
Clear caches, test key pages, forms and logins, and run a broken-link check.