This web site was originally created and maintained using [CityDesk](http://www.fogcreek.com/CityDesk/) from [Fog Creek Software](http://www.fogcreek.com/). CityDesk is a great tool for the job, but it only runs on Windows and I’ve moved to the Mac, so maintaining the site was becoming a pain.
I was looking for a server-based content management system, and [WordPress](http://wordpress.org/) was the most suitable one I could find for my needs. It’s not perfect, but it’s easy, convenient, and very good. And it’s free.
When I set WordPress up, I installed it into the /dacollins/ subdirectory (i.e. [http://pool-room.com/dacollins/](http://pool-room.com/dacollins/)). This was a convenient way to spend time tailoring things, setting up my templates and plugins, importing content, etc without impacting my main site. All the changes were confined to a single subdirectory, and it wasn’t publicised much so I didn’t have to worry about breaking links as I played around and reorganised things.
Finally, after 2 or 3 months of on-again-off-again tinkering, I got everything just how I wanted it and was ready to copy WordPress to my site’s root (i.e. [http://pool-room.com/](http://pool-room.com/)).
The WordPress web site has some good instructions detailing [how to move your site](http://codex.wordpress.org/Moving_WordPress), and it worked exactly as advertised for me. The only thing I added was a line in .htaccess to redirect requests for the /dacollins/ subdirectory to the root directory – so if someone clicked on their bookmark for [http://pool-room.com/dacollins/category/family/](http://pool-room.com/dacollins/category/family/), they’d be automatically redirected to [http://pool-room.com/category/family/](http://pool-room.com/category/family/) instead of encountering a 404 error. Click on the links to see how it works.
Assuming you’ve got mod_rewrite turned on, the line to add to .htaccess is:
RewriteRule ^dacollins/(.*)$ $1 [L,redirect=permanent]
This basically just strips the ‘dacollins/’ out of the URL.
I’ve left all the original CityDesk files where they were. You can still see pages from the old web site [here](http://pool-room.com/Personal/index.html) for example. This makes sure that any pages that were indexed by search engines or linked to by other sites are still online, but new visitors will only see the new site.
Comments
3 responses to “Moving WordPress To A Different Directory”
Do you know of a way to go one step further with this? I’ve moved my blog to the root and am tryingto redirect as follows:
http://www.mysite.com/blog/157/best-post.php/
to
http://www.mysite.com/best-post.php/
Your rewrite rule gets me to:
http://www.mysite.com/157/best-post.php/
Is there a way to get rid of the /157 (post id) on rewrites?
Thanks
I guess it’d be something like:
RewriteRule ^blog/[0-9]/(.)$ $2 [L,redirect=permanent]
I haven’t tried it, but I think it would work. Let me know if it does, or how you modify it to make it work.
I clicked on your link http://pool-room.com/dacollins/category/family/ and got a 404 error.
I also tried your line to add to .htaccess and it does not work for me.
Any suggestions?