I published the article in Vietnamese about how to change a domain in a WordPress website. Just note down here the most important step which can save your day!

Requirements

  • Your new domain works and your website using a new domain must work (update database, url, etc…)
  • Your old domain still works and pointed a WordPress website.
  • Your hosting/server must support a custom .htaccess

Update your .htaccess

Find:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

And update it to:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^old-domain.com$
RewriteRule (.*)$ https://new-domain.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Then try it. You will see the magic.

Leave a Reply

avatar
  Subscribe  
Notify of