rainy day and blog relocation blues

| 8 Comments | 1 TrackBack

Seems like it's been raining forever, though it's probably been less than a week. Forecast shows no sign of it letting up. Sitting at home today, sipping tea, wishing I could snap my fingers and have elves or djinn clean my house.

I should be reading research, writing the grant questionnaire, organizing materials for courses in the fall, building any of a number of websites that I foolishly said I'd work on this summer, finishing the cropping and enhancing of my sister's wedding pictures.

Instead, I'm working on strategies for migrating this blog to www.mamamusings.net. After reading through a relevant entry on Jonathon Delacour's (now inactive) blog, I think the way to handle permalinks will be to use a meta refresh tag in the old files here, redirecting to new archive locations on the new site. The meta tag makes more sense than .htaccess, because I can use MT tags to create highly customized redirects. Each individual entry can be redirected to a new URL with the new site base, as well as the date path and post title. If I'm understanding this properly, I can add the following tag to my individual archive entries on the old server:

<meta http-equiv="refresh" content="2; url=http://www.mamamusings.net/archives/<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.php">

As a result, pages with addresses like this:

can be automatically redirected to pages with addresses like this:

The more technically inclined amongst you are cordially invited--nay, beseeched--to point out errors in my approach before I do anything stupid.

I have read through the comments in the above-cited post regarding pros and cons of title-based archive file names vs entry number file names. While the title-based names are a problem if you change a title, the entry-number-based names are a problem if you change a server. Since I've not yet changed a post title (that I can think of), and could always handle that with a simple redirect if necessary, the server-switching problem strikes me as a bigger deal.

Weez asked me yesterday why the server switching causes problems, which probably isn't obvious to anyone who hasn't worked with databases enough to understand primary keys et al. So, for those of you wondering why moving servers would cause problems with entry numbers, here's the short version.

When you add a post in Movable Type, it turns the post into a record in a database table, and the database software automatically assigns that record a unique (auto-numbered) ID. That happens whether it's a draft or a published post. If you later delete a post--draft or published--that ID number does not get "freed up"--the database software will autonumber from where it left off, without filling in the holes.

Similarly, if you're maintaining more than one MT blog on your server--for example, I have mamamusings, some class blogs, and some special-purpose blogs--all blog entries go into the same database table. So if I post an entry here that's numbered 225, and a student then posts to a class blog, the student's post will be numbered 226.

As a result, many (if not most) MT blogs have entries that are not all consecutively numbered. (Look at your own MT blog if you have one. Are the entries all consecutively numbered? Probably not.)

If you want to move your blog to another server, MT provides an export function that dumps out all your entries. But that export doesn't include record numbers. When you then import the entries at their new home, they'll be assigned unique ID numbers by the database software again--and those numbers will probably be different. So simple automatic redirects -- from oldserver.com/000100.html to newserver.com/000100.html -- won't work. You'd have to figure out exactly what the new number was for each entry, then hand-code the redirection. Blah.

Shelley offered me a good solution for preserving the numbers--which I tested today, and it worked. She suggested that instead of using MT's export and import functionality, I export and then import directly using the mySQL database that stores my posts. Doing that does preserve the record numbers. However, it also presumes a fairly sophisticated level of understanding of databases. While I could do it, I wouldn't recommend it for most folks.

Because I was able to preserve my entry numbers, I could conceivably do a simple redirect from oldserver/entry.html to newserver/entry.html. But I like the idea of switching now to name-based entries so that any future moves (say, to a new hosting provider) are less stressful.

If I stick with numbered entry archives, and decide to switch mamamusings.net to a new provider, I've got to go through the more laborious procedure of moving the database in toto from the old server to the new. If I go with named entry archives, I can use the MT export/import without risk of broken links.

And now, I think, it's nap time.

1 TrackBack

Good to know about migaring MT to other servers from LinkLog - Interesting bits and bytes on July 24, 2003 3:52 PM

Liz Lawley is moving her blog to a new domain. In her two most recent posts she describes some problems that may occur when moving MT to a new server.... Read More


Unless I�m missing something significant I think here is no elegant solution for this dilemma Liz. The problem with meta-refresh is that it �breaks� the back button. What happens is that when you try to backtrack through the redirect page it keeps forwarding you on. I posted on this once at http://weblog.stanton-finley.org/archives/000033.html .

is there an advantage to keeping MT with a database versus pure archiving? I don't use a database, and just wondered why you chose to.

I also am curious to know if name-based archiving is an option? I'm pretty happy with just category, month, and individual, but have you found that naming offers anything more than a name-specific way?

And yeah, the export works beautifully if you don't use databasing. i'm walking, typing proof :)

Brendyn, MT is completely database-driven. The only issue is whether you're using mySQL (which I am), or the Berkeley DB that ships with most unix systems (which you are). Either way, all of your data is stored in the database, and then published out to index and archive pages each time you rebuild the site. (See the install directions for MT...)

One advantage of mySQL is that you can write your own queries to extract data from the database, which is how Shelley does a lot of the "backtrack" and "talkback" features on her blog. Another is that you can do the kind of direct database exporting that I did in order to preserve unique identifiers.

As to the names, I'm not talking about a different type of archive. It's just an issue of whether I want individual entry archive pages to be named 000504.html or fear_of_flying.html.

Since your old blog isn't still running, you can't compare and contrast...if you could, you'd see that your current individual archive permalinks have different numbers than the same entries had on the older blog. That means if there were a lot of links pointing to your old site that you wanted to automatically redirect to your new site (sparing people the dreaded 404 error), it would be difficult to accomplish.

Stan, you're right about the problem with refresh tags (thought that will only be an issue for people following old permalinks, which I'm hoping won't be too many). However, I may play around with using some php magic to fix the broken back button problem. I think there may be a way to trick the browser into "forgetting" about the page with the meta refresh tag.

Here is another possible solution:

Hmmmm. That's good for starting from scratch (and thinking through names and locations for the new server's archives), but I don't see it addressing the issue of redirecting from server 1 to server 2.

Am now thinking that it might make more sense to generate a big-ass .htaccess file with redirection rules after all.

Funny, I've been thinking about this lately too. My solution was to put the rebuild the entries with the date in the individual entry filename.


I'm going to have to do something like this in the fall when I move back on RIT campus and get my own webserver back up and running.

Seeing as my archives are already in the year/month/date/title.extension format, I can only see either redirects or meta-refreshes working to send people getting linked from google over to my real blog when it moves off grace and onto my server.

About this Entry

This page contains a single entry published on July 24, 2003 11:47 AM.

fear of flying was the previous entry in this blog.

step away from the podium is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


Category Archives