Move WordPress to new domain with full URL redirects

Disclaimer: If you break something, too bad. You’re responsible for your actions. This worked for me.
Take backups of your database and files for both domains!

It’s usually not recommended to switch domains since search engines might take some time or not index your moved stuff at all for some reason. Also, frequent visitors might stop visiting your site and old links might stop working after a while if you let the old domain expire…

But lets say you really want to move the domain.
First, it’s important that you use the same permalink settings on both sites otherwise this will not work.

Ok, lets begin, login to WP Admin.
Go to “Tools” and choose “export”.

Export everything and save it as a XML-file.
Don’t worry about the pictures and stuff, WordPress will download that later automatically.

Now, go to your new site and under “Tools” you’ll see “Import”.

Just import it, it might take a while if your site is huge. Don’t click the button twice.

Is the Import OK?
Good. If not… Well, Google and find out what’s wrong.

If it’s good, then login to SFTP/FTP or whatever and open your “.htaccess”-file on the old server and place this bit of code there:

# BEGIN WordPress

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.nordicnode\.com
RewriteRule (.*) https://www.nordicnode.com/$1 [R=301,L]

# END WordPress

Replace my domain name with yours by the way. 😉
Hopefully you got it working with the permanent redirects now!