Switching WordPress Blog URL to subdomain

(Reading time: 2 – 4 minutes)

So you want to switch your blog to a subdomain, and you want everything to work.

Yeah, right!

Ok, it’s not that difficult, but it is a little bit picky. You will need to pay attention and be careful.

As usual, the first thing to do is back up everything:

  1. Database backup, and
  2. WordPress installation backup.

We want to use the subdomain http://blog.mydomain.com/ mapped to http://mydomain.com/wpblog. The benefits of this are:

  1. Looks more professional.
  2. Helps shroud the site structure from bonehead script kiddies.

A real professional, thoroughly malicious hacker probably won’t be fooled. Then again, the pro isn’t likely going to smash your site either by accident or for fun. He wants to use your bandwidth anonymously, not get you kicked off the host.

The next thing to do is put on some decent music. At the moment, I’m in the mood for Norman Fairbanks “7 Days Microsleep,” billed as the first purely Tenori-On album released. If you aren’t familiar with the Tenori-On, Little Boots will demonstrate it’s capability on a cover of Hot Chip’s “Ready for the Floor.” You can’t buy this album. You have to download it from One American Second. Make sure to leave a tip!

Now get a notebook. A paper notebook, with pen or pencil. You can always punch your notes into your computer later; this is one of the few times I believe paper and pen are best. As you follow the procedure, write down exactly what you do and how you do it. This way if you have to backtrack, it will be much easier.

Log on to your hosting provider. I’m at Bluehost; I’ll be using their cPanel interface.

  1. Open your FTP client.
  2. Create subdirecory (wpblog); move all WordPress files there
  3. Log in to cPanel.
  4. Create subdomain using cPanel tools: blog.mydomain.com -> mydomain.com/wpblog
  5. Go into phpmyadmin, find the database, click on that, click on wp_options table, click on “Browse”, fix the paths field: mydomain.com -> blog.mydomain.com
  6. Go into wp-admin page, fix paths: mydomain.com -> blog.mydomain.com
  7. Optional Add the redirect using cPanel: mydomain.com -> blog.mydomain.com

That’s the fast and dirty, and it worked fine for me.

If you have enough traffic that you want to preserve your SERPs, you will need to add appropriate 301 redirections. I recommend using John Godley’s Redirection plugin for this chore, which makes it much easier.

Let me know if you have any trouble with this procedure. If the mere thought of this gives you the willies, drop me a line and we’ll talk about it.

Comments

  1. Ben says:

    Great post! Thanks for sharing. I need to do this on one of my sites.

  2. rolf says:

    hello,

    how does one add Sub-domain to wp?

    for example:
    i host my wp site test.com
    if already created subdomains at registrar i.e. art.test.com and music.test.com
    how do i set this up at wp cpanel?

    do i go to Settings > General?
    do i enter test.com for WP URL
    but art.test.com for Site URL?

    what’s difference between WP & Site?

    if i want to add 2nd, 3rd etc. subdomains to my wp site, how do i set up wp for that?!

    thx!

    • Dave Doolin says:

      Rolf, that’s a lot of questions, none of which have simple answers.

      My advice: get a piece of paper and a pencil, and start experimenting. Do something and write down the results.

      If that’s too much trouble, you can probably get it done for about $100. Which is probably your cheapest option considering the value of your time.

Speak Your Mind

*

CommentLuv badge