February 4th, 2010 §
Sometimes, albeit rarely, I will need to move all my posts from one WordPress blog to another one. This is a daunting task, but it does not need to be.
WordPress and .htaccess actually make this very easy! In three easy steps, you can have all of your WordPress content moved from your original blog location to your new one.
Side Note: This blog post assumes you have set up your new website and installed WordPress (2.9.1 or better) there already. If you need to, upgrade your WordPress installation before going on.
1. Export all of your blog posts
With WordPress you have access to a tool for exporting all of your content into an XML file format. Do not worry about what XML is, or why it exports to this format. What you need to know here is how to export and where the file saves, let the rest be taken care of by WordPress.
To get to the export tool go to the left sidebar and click the downward arrow next to tools like so:

Click the arrow here
The menu will look like this when it expands:

Expanded Tools Menu
Now click the “Export” link, and you will see the following:

The Export Page
You can choose which author you want to export, but for our purposes we are moving ALL the content, so we chose to leave it on “All Authors”. When you hit the download button, you will be prompted to open or save the file. Just save the file in a location on your computer where you can find it easily.
2. Import all of your blog posts
Once you have an export file saved to your computer, you are ready to go back to the same Tools Menu from above, but on your new blog site. Click on “Import”. Here, you will see a page that looks like this:
Since we are going to import from a WordPress blog, click the blue “WordPress” link at the bottom to see this page:
Just like a normal upload form, click the browse button to choose the file you downloaded in the preview step. Then click “Upload and Import”, which will allow your new website to pick up the posts you exported.
You may get an option on the next page, which will say “Import and Download all attachments”, DO THIS. It will allow WordPress to download the attachments in each of your original posts from your old server and put them on your new server. This will let you keep the great content you worked so hard to create the first time.
The last option you get is what user to import all the posts as. Go ahead and choose the username you want all of your posts to show up under.
Once you see all the posts are on your new site, you are ready to make sure that ALL traffic from your old domain go to your new one.
3. Setup .htaccess on the old blog to redirect all your traffic
The .htaccess file is a little file that works in the background on your server. It is typically used to tell the server some special action to perform whenever a page is requested. In this case, we are going to tell it to redirect ANY traffic from the old domain to the new domain and make sure the URLs are similar. This is important because if someone goes to your post about how delicious spam is on the old server, you want them to go to the same post on the new server.
You can actually just download an example .htaccess file with the link below. You will need to edit the part that says “old domain” and the part that says “new domain” to be your old and new domains, respectively. The rest of the code in the file is exactly the same as what WordPress has you put in by default.
Example .htaccess file
You will actually edit the .htaccess file that comes with WordPress to have this extra content (this is in the example download above):
-
Options +FollowSymLinks
-
RewriteEngine on
-
RewriteCond %{HTTP_HOST} ^olddomain.com [NC]
-
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
DO NOT WORRY about the other code, just find this block and change the URLs appropriately.
The final code will look like this:
-
# BEGIN WordPress
-
<IfModule mod_rewrite.c>
-
RewriteEngine On
-
RewriteBase /
-
-
Options +FollowSymLinks
-
RewriteEngine on
-
RewriteCond %{HTTP_HOST} ^olddomain.com [NC]
-
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
-
-
RewriteCond %{REQUEST_FILENAME} ^wp-content.*
-
RewriteCond %{REQUEST_FILENAME} ^wp-admin.*
-
RewriteCond %{REQUEST_FILENAME} ^wp-include.*
-
RewriteCond %{REQUEST_FILENAME} !-f
-
RewriteCond %{REQUEST_FILENAME} !-d
-
RewriteRule . /index.php [L]
-
</IfModule>
-
# END WordPress
-
-
Options -Indexes
Once you have the file edited with your new URL, just upload it to your OLD server so that it replaces the old .htaccess file.
Now, try to go to the old website with any blog post link (search Google for pages from your site), and see what happens to the URL when you go there. You should see the URL change to the new server’s domain with the same post path as you selected.
You are now set up and ready to go on your new server.
Sphere: Related Content
November 15th, 2009 §
November 12th, 2009 §
Well, it was this morning. I didn’t realize it until I went to schedule a blog post for 12 hours later and it published immediately. I was concerned and actually went to blame WordPress first (I’m really not sure why). However, when I was looking at the time preferences in the General settings area of the site I noticed something really strange. My timezone was correct, but the date WP was showing was way off. This meant that my CentOs5 server’s time was way off.
I did a little research and found an article called “Setting the time of your system“. They gave me some good solutions on how to fix the issue, after reading it I was ready to go. I tried a couple things in the order they said and found myself a little confused. So naturally, I started trying things till they worked. This is not always the best solution, but I figured I could deal with a timing issue if I messed it up worse than it was.
For my CentOs 5 server I did the following, which actually worked and set the time perfectly.
First, I checked the date the server had, which turned out to be way off.
-
# date
-
Thu Nov 12 23:56:41 MST 2009
Then I looked to see if ntpd (the automatic time adjustment service) was running, it was.
-
# service ntpd status
-
ntpd (pid 12019) is running…
I tried ntpdate to reset the time on the server, but it complained about the socket being in use.
-
# ntpdate 129.6.15.28
-
12 Nov 23:57:28 ntpdate[12045]: the NTP socket is in use, exiting
My solution was to stop ntpd and then run ntpdate again, which worked!
-
# service ntpd stop
-
Shutting down ntpd: [ OK ]
-
-
# ntpdate 129.6.15.28
-
12 Nov 07:25:10 ntpdate[12063]: step time server 129.6.15.28 offset -59562.023808 sec
A simple restart of the ntpd service and the time was correct!
-
# service ntpd start
-
Starting ntpd: [ OK ]
-
-
# date
-
Thu Nov 12 07:25:20 MST 2009
So, the solution was to do the following steps:
-
# service ntpd stop
-
# ntpdate 129.6.15.28
-
# service ntpd start
-
#date
I added “date” on the end, because you want to verify that the time actually did reset. Best of Luck!
Sphere: Related Content
November 12th, 2009 §
Bit.ly starts with a simple idea, shorten URLs. You pass a URL to them, then they give you a randomly generated short URL.
Bit.ly is a very useful tool for shortening your URLs for Twitter or easy sharing with clients and co-workers. The Twitter community has embraced Bit.ly as top dog in the URL shortening world. There is great competition for them, so the hope is that we will see some real innovation in the shortening and tracking of URLs.
There are more features aside from URL shortening that Bit.ly provides, some of which you may be missing out on.
Track Your Click Throughs
Whenever you add a URL to Bit.ly, it is immediately added to their database of URLs. After the first person clicks your link, Bit.ly’s tracking kicks in. They will count every click on your URLs. They also will provide you with the cumulative total of clicks from every user who has shortened and shared the URL you are looking at.

Find recently used links quickly
I often will post a link, then go looking for it well after it is buried in my Twitter stream. Bit.ly serves a great purpose by letting you quickly scan through pages of your most recently used links. Not only that, but they allow you to rename the links in the lists, so you can find them easier!
Get an idea how much traffic your competition is getting
Since you can submit any URL you want through your bit.ly account, this means that if you see your competition submit a URL through bit.ly you can track it too! All you have to do is get the URL that you are redirected to by bit.ly and shorten it with your account. Immediately, it should show up in your account with the number of clicks that the full-size URL has received.
API
Bit.ly allows you to push and pull information with their API. This is invaluable to applications like Twindicate and Tweetdeck, who need to provide the shortest URLs possible when writing Twitter Posts.
I could not write this list without sending out some good vibes by requesting some features. What Bit.ly needs:
Quick Search
I would love to have a search mode. There would be a search box, where you could type anything and Bit.ly would search through your data and return matches based on URL and title. This would make finding links even easier and inspect links further back in time.
Better Link Title Special Character Scrubbing
Nearly every time I submit a blog article through Bit.ly and see it in the list it looks like this:
Most Recently clicked view
Man, this would be living! If you could see which links were most recently clicked, it would be easier to find out if a link of yours is doing well even after it is buried by more recently added links. What would you do if you were the last to find out that some link you posted actually went viral? What would your clients do if they found out through some chain email instead of from you?
Aggregated Mine/Theirs stats
This feature would probable be just for me to use for bragging, but having the stat of “lifetime clickthroughs” on my account would be pretty cool. This way I could see how much or how little I actually contribute to the Social Community through my links. Since nearly all of the links I send out are Bit.ly links, it would be a pretty good gauge.
Ninja Side feature idea: You could create a game based on the sharing of Bit.ly links and who else shared the link.
API Feature: Pull more than one link’s info at a time
I really very much want to more fully integrate Bit.ly into one of my projects. Being able to pull a mass amount of data instead of one at a time, would make what I want to do possible.
It would be sweet to be able to get all the links for a specific user. But, if I could just send in 15 URLS in one request and get data returned for all of them at once, that would make my day.
Are you using Bit.ly yet? Why not?
Sphere: Related Content