redirection solution

| 9 Comments | 10 TrackBacks

Took my relocation/redirection problem over to #joiito, where I tossed around some possible solutions (meta refresh tags, .htaccess files, sql queries, etc). Then I saw server guru Mark Pilgrim lurking in the channel, and asked his advice.

Ever the gentleman, Mark not only advised me to take the .htaccess route, he even whipped up a quick MT template for me to generate the .htaccess file with redirects.

The one he created would be run on the new server, and so assumes that the post IDs are the same (they are, since I did a mySQL export/import rather than using MT). Then the file would be placed on the old server. The archive template looks like this:
<MTEntries lastn=”999999”>

Redirect permanent /archives/<$MTEntryID$>.html <$MTEntryLink$>
</MTEntries>

If I hadn’t preserved the post IDs through mySQL, however, I think an alternative would be to create the .htaccess on the old server, using this template:
<MTEntries lastn=”999999”>

Redirect permanent /archives/<$MTEntryID$>.html http://www.mamamusings.net/archives/<$MTArchiveDate format=�%Y/%m/%d�$>/<$MTEntryTitle dirify=�1�$>.php”
</MTEntries>

Either way, I’d end up with a lengthy .htaccess file that I could then place in the archives directory of the old server (after creating all the files on the new server, natch).

I think that ends up being the most elegant solution. Thanks, Mark! (Thanks also for publishing your blog templates; those were also extremely helpful.)

10 TrackBacks

New URL's from Jeremiah Oeltjen's Blog on July 28, 2003 3:47 AM

In reading Elizabeth Lawley's post about URL redirection that she is now using to redirect the archive links using MovableType's default six-digit numbered style (/archives/000022.html) to the date/dirified title just like Mark Pilgrim. This is a reall... Read More

New URL's from Jeremiah Oeltjen's Blog on July 28, 2003 3:53 AM

In reading Elizabeth Lawley's post about URL redirection that she is now using to redirect the archive links using MovableType's default six-digit numbered style (/archives/000022.html) to the date/dirified title just like Mark Pilgrim. This is a reall... Read More

If you change your weblogging environment, such as move to a different tool, different archive structure, or even different server and domain, and others have linked to your posts, you're going to be leaving broken links behind. What can you? Actually,... Read More

mamamusings: redirection solution... Read More

New Archive URLs from Flexistentialist on October 12, 2003 11:07 PM

In case you are interested, there is a new format for the archive URLs. Instead of looking like http://www.flexistentialist.org/archives/000325.shtml, which... Read More

Redirection from Population: One on October 19, 2003 5:52 PM

The redirection solution I’ll use when I get around to fixing my archive permalinks comes from Elizabeth Lawley. Clever stuff.... Read More

Over the last week, usually in the mid-to-late evenings -- after Catherine falls asleep, I have been slowly migrating my B2-based blog to Movable Type. I must say that for the most part the process has been fairly straight forward.... Read More

Over the last week, usually in the mid-to-late evenings -- after Catherine falls asleep, I have been slowly migrating my B2-based blog to Movable Type. I must say that for the most part the process has been fairly straight forward.... Read More

If you change your weblogging environment, such as move to a different tool, different archive structure, or even different server and domain, and others have linked to your posts, you're going to be leaving broken links behind. What can you dp? Actual... Read More

I've recently moved to a new host and made some backend improvemtents to my site and my blog Asterisk. Details about what I've done and what's to come. Read More

9 Comments

Perhaps more women would be in technology if more women were listened to...

My htaccess file is:

RewriteEngine On
RewriteCond %{REQUEST_URI} \.php$
RewriteRule ^(.*)\.php$ http://weblog.burningbird.net/fires/$1.html [R=301,L]

to redirect PHP requests from /archives to HTM requests in /fires. And since it uses mod-rewrite, performance is quite good. Better than with redirect -- and less space. One tiny file.

If you want, you can vet this solution past Sam Ruby.

My apologies for the implication implicit in the last comment -- but I was a bit hurt to see this post.

Regardless, you should consider this approach, at least think about it. If you want to discuss it at the IRC, I think you'll find that most people, perhaps even Mark, will agree that you'll probably get better performance. If you don't have mod_rewrite installed, I can rewrite this using an alternative approach.

Or use your approach -- it's your weblog.

I'm not 100% sure I have access to mod_rewrite on the it.rit.edu server.

The problem with mod_rewrite, though, is that I'm going from numbered entries on the old server to "dirified" entry names on the new server. So there won't be a standard rewrite rule I can use.

For example, I'll want to redirect from http://www.it.rit.edu/~ell/archives/000504.html to http://www.mamamusings.net/archives/2003/07/23/fear_of_flying.php.

So far as I can tell, I wouldn't be able to do that with mod_rewrite. But the .htaccess approach allows me to generate a list of relationships between entry number and new name.

Since there are only about 330 entries, and I don't tend to get super-high traffic on my archives, it seemed like a reasonable tradeoff.

(Please do note, also, that I _explicitly_ thanked you by name and linked directly to your comment in my previous rainy day post. There are lots of people who have been generous with their expertise as I work through this, and I'm genuinely grateful to all of you.)

As I said Liz, I'm sorry. You're right -- that was churlish of me.

You're going with the new format on the new server -- I had missed that in your note (missed the previous posting, too, originally). You're right in that this complicates things.

Sorry.

S'okay. I'm a bit grumpy tonight, myself. Single-parenting doesn't agree with me, and I've spent too many hours with the laptop instead of real grownup people today.

wow. looks complicated. geeez. what if i decide to move my Radio weblog hosting to a self-hosted MT solution on the digitaltavern.com server? I have no idea how permalinks could be saved, let alone just getting it to work.... and Joi wants me to move to Moveable Type...

mod_rewrite lets you do all sorts of fun redirections, and the redirects are pretty easy to customize within Movable Type templates. Even if you're switching servers and file naming schemes at the same time, it won't take much code. Here's my current rewrite template:

http://blogs.bwerp.net/templates/archive_rewrite.template

And the resulting .htaccess:

http://blogs.bwerp.net/archives/htaccess

Sounds like you determined that the IT webserver does not support mod_rewrite, or at the very least it doesn't allow it in your .htaccess. Personally, I think it's something worth making some noise over, especially with a blog as linked to as yours.

Cheers.

So what does mod_rewrite buy me that redirect permanent doesn't?

I wasn't aware of `redirect permanent' until your previous comment. They seem to do the same thing in this situation. I would expect that `redirect permanent' requires less overhead than mod_rewrite, since mod_rewrite is built for conditionals and regexes and such, but don't quote me on that.

So, carry on. O=)

About this Entry

This page contains a single entry published on July 24, 2003 4:14 PM.

step away from the podium was the previous entry in this blog.

welcome to my new home is the next entry in this blog.

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

Archives

Category Archives