Moving WordPress

Sun, 23 July 2006

When I first registered this domain and installed WordPress I possibly made a mistake and used automatic installation with my hosting provider. When doing so, the only way to install WordPress is inside the directory, you can’t install it into the root of the account. So thinking this was going to be a blog I have installed it under www.silvermac.com/blog/.

Mike wondering how to move WordPress from one directory to another

(Me thinking. Oh yes, it does happen sometimes)

While this wasn’t a big issue at the time I have noticed that my website is listed as blog with most of the search engines, particularily with Google. If go to Google search page and query site:www.silvermac.com or site:www.silvermac.com/blog/ there would be zero results.

However, if I go to http://www.google.com/blogsearch and do the same, I get plenty of indexed pages. I have tried to address this with Google over the past few months but with no result at all, all I get is automatic response, directing me to webmaster’s guide kind of thing.

Yahoo and MSN searches are better, in fact MSN indexng is just spectacular, I’m pretty sure I’ll be able to find this post with MSN already tomorrow.

Anyway, I decided to do unthinkable and move my whole site one level up, from silvermac.com/blog/ straight to the root - silvermac.com. One disadvantage of this would be having dead links all over internet but that’s the price I think I have to pay.

I have created the custom 404 page with included links to several most popular pages so this might help a little. The number of visitors has dropped instantly to about 20% of what I had over the past few months but I hope with the time this will change.

So I backed up the database first and coped it to a burried directory on my computer. Not that I need to touch the database at all but I’ve been through trouble before.

Then I downloaded entire content of the /blog/ directory to my local drive and made a copy to the same burried directory, as this is the one that must not go wrong.

The next step was to upload the whole content of this directory back to the web server, this time to the root, so to / . Once uploaded, I logged in to the administration panel and changed the WordPress home page to http://www.silvermac.com

home.jpg

When I logged out and typed www.silvermac.com into my browser I was served with my home page, no problems at all.

But, all the links were still pointing to …/blog/. For example I would click on “About” page, the link would point to www.silvermac.com/blog/about/ and consequently serving me with the 404 page. Ouch! Database editing - nooooo!

Then I thought, my permalinks use custom format /%year%/%postname%/ so I might try playing with this. It really wouldn’t matter if I change this to include month or day since all existing links on the web would be wrong anyway. So I quickly changed permalinks to the default format, i.e. www.silvermac.com/?p=238, saved it and tried, everything worked. Phew!

I tried again to go to the custom format I had before and this time it worked fine, it must be WordPress caching it somewhere, but the change of the format has cleared it.

permalinks structure

I’m still not quite sure if the last step is really needed or it was just something wrong in my case, but moving it from one directory to another was dead easy.

Now if I only could hack into all these sites containing link to my website and correct them …

[tags]WordPress, moving, blog [/tags]

Stumble it!

Related posts

Web hosting - UNLIMITED space and transfer - $ 6.95 per month

2 Responses to “Moving WordPress”

  1. Fairly pointless to digg. However in your 404 you can use PHP to get the requested file, and add send a new header to the browser redirecting to ../$pagetheywanted. Or use a meta redirect. Both of these methods should work. Also if you used fantastico/cpanel to make the blog, you’re def given an option to install to /, however the default is /blog/. If you need help with the PHP email me or something.

  2. thank you very much for this little hack. i had set up a test version of wordpress in a folder on my site, testing wordpress’s ability to serve as a homepage cms. when i realized i would have to redo all my work if i tried to set up another installation, i googled ‘moving wordpress folder’ and found this.

    i did not have to fix my permalinks since it seems like everything changed correctly when i switched over.

Leave a Reply