I have been running my blog on the URL wp.dembowski.net for years. If you are familiar with WordPress then that’s an OK URL to use but most people are more comfortable with a generic name.

I did not want to use www.dembowski.net (already used for a place holder) and did not want to put move to a folder off of the web server. So I picked blog.dembowski.net and moved my WordPress install this morning.

It went very well.

I created a new virtual server for blog.dembowski.net on my server and enabled it in Apache 2 (a2ensite blog.dembowski.net) and copied all of my files from the old wp directory to the new blog directory.

I used my nightly backup script and produced a text file of my mysql database. I then ran this command on that text file:

$ cat wp-database.sql | sed -e 's/wp.dembowski.net/blog.dembowski.net/g' > new-database.sql
$ cat new-database.sql | mysql -D blogdbname -u blog-user -p

I did it that way on purpose so that I could always restore the old wp.dembowski.net setting if I messed this up. By hunting through and changing every instance of wp.dembowski.net to blog.dembowski.net in the database backup file, I guaranteed that even obscure plugin settings would get updated as well.

In my old directory I moved everything out and left a two line .htaccess file like so

RewriteEngine on
RewriteRule (.*) http://blog.dembowski.net/$1 [R=301,L]

That way any hits to http://wp.dembowski.net/some/thing/here/ will get 301 Permanently Moved to the same URL but on http://blog.dembowski.net/.

After a little testing everything is confirmed to be working. I am in the process of updating my stats settings in Clicky and Google Analytics but so far so good.