Moving a WordPress-powered site to another domain: The Permalink

Yesterday, I needed to move a self-hosted to another . The process was easy because it’s like copying all files, edit the and editing internal links in all posts. All process only took than 15 minutes. But, that’s not the only thing. One of the important things needed is to maintain the article links — known as “permanent link”.
This is important because I don’t want to send the visitors coming from other sources (links in blog posts, shared link on or ) to missing pages. It’s called “permanent link”, right? So, having the permanent link broken is not a good idea.
I came up with a simple solution: using .htacess. After moving all files and checking all configurations I put these lines in the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^.*olddomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

So, when visitors visit olddomain.com/path/to/article/, the browsers will go automatically to newdomain.com/path/to/article/. Easy!

One reply on “Moving a WordPress-powered site to another domain: The Permalink”