Archive for September 2010
30
Changing domain names for WPMU and lighttpd
4 Comments | Posted by mindby in Tips and Tricks
Ouch! I let one of my domain names expire on Tuesday and BAM someone pounced on it. Not normally a big deal unless it’s worth something, this one was. It wasn’t that it was valuable monetarily, however it was the primary domain I used for my Wordpress MU site. I suddenly found myself with a half working website, not good. Took me an hour or so to piece everything back together so I thought I’d share it.
- Stop lighttpd
- I had to change my DNS records at my provider and update with a new domain to take over for the lost one
. - Modified /var/www/wp-config.php variable DOMAIN_CURRENT_SITE with the new domain
- Modified /etc/lighttpd/lighttpd.conf and replaced the old $HTTP["host"] entry
- Unfortunately WP sticks the domain name of your primary site EVERYWHERE in the database which was a real bummer. After I had found it in more than a few places I decided I’d better dump the database, replace using vi and then import the database back.
- mysqldump -u username -p wp_databasename > databasename.sql
- I then used vi to do a global replace of the old domain with the new
- I then dropped the old database and recreated it with the same name.
- Importing the database is easy with mysql -u username -p wp_databasename < databasename.sql
- Restart lighttpd
I think that’s it. It seems to be working again and hopefully this will help someone out of a jam in the future.
Word of caution: I’d do a backup of everything before I starting and I also can’t promise that this will work if some WP plugin is doing anything strange with the domain name. Good Luck.
