Login | Register

June 2004

Reorganizing Your Website - Renaming Permalinks

Jun/30/2004 02:57 PM

This is an issue that I have been pondering for a little while. How could permalinks in Movable Type be changed. By definition, permalinks should be permanent. But, what if all those all links still worked while at the same time completely redoing the URL scheme.
BTW, assume I am talking about the Apache webserver unless I mention otherwise since that is what I am using.

There are a couple ways this could be done. For instance, if the filename is generally going to stay the same, say, changing from http://www.yourwebsite.com/archives/000255.html to http://www.yourwebsite.com/blog/entries/page0255.php then you could write a single rewrite rule in your .htaccess file that would handle that. I know very little how to do this, but with the knowledge it should be fairly simple.

But, I want to move my files from the default /archives/000001.html scheme that is setup to a more natural and organized /year/month/page_title.html. The problem is every page title is unique and only Movable Type would know what those are and what the year and month is for the posts. Had I known more about Movable Type before I started my website, then I probably would have gotten this right to begin with, but it was much more fun to jump into it and learn as I go.


So, what I have come up with was this. Create a new index template that will generate Apache redirect commands that can be placed into a .htaccess file. The template code will be in this format:

<MTArchiveList>
<MTEntries>
Redirect permanent [Current Archive Path][Current Archive File Template]</MTEntries> <$MTBlogURL$>[New Archive File Path, if any][New Archive File Template] </MTArchiveList>

Basically, the same tags used to create the master archive page, but modified to output the 'Redirect permanent' statement that the .htaccess file in Apache uses to redirect the pages, then the path to the old names using the default archive scheme, then followed by the new scheme. This of course could be modified to whatever current archive format you are currently using followed by the new format you will be changing to.

Here is how my code looked:

<MTArchiveList>
<MTEntries>
Redirect permanent /archives/<$MTEntryID pad="1"$>.html</MTEntries> <$MTBlogURL$><$MTArchiveDate format="%Y/%m/"$><$MTArchiveTitle dirify="1"$>.html </MTArchiveList>

One thing to notice though, for this to come out right, you will want to use the MTArchive tags, but when you edit the Archive File Templates in your Movable Type system, you will need to use MTEntry tags.
So, my Archive File Template will look like:

<$MTEntryDate format="%Y/%m/"$><$MTEntryTitle dirify="1"$>.html

If you have never changed the Archive File Templates, you can do this my going to the Movable Type Control Panel, then going into the 'Weblog Config' and clicking on the 'Archiving' link. I am changing the Individual archive template here, so in the box that says 'Archive File Template' is where the changes would need to go.
You might also want to change the archive URL on the 'Core Setup' section of the weblog config. That is what I have listed in the this color. My original archive URL was http://www.cbulock.com/archives, so all the archives were behind that. My new setup just has http://www.cbulock.com as the archive URL since I just wanted the archives to be organized my year and month, but still having an archive URL is okay, it just has to be considered when changing this all around. Also, make sure to be careful of any other archive file templates you might have if you change the archive URL, since they will also need to be changed. I forgot about this at first and it messed up my mobile version of the site.

All that needs to be done now is for the template containing the code above to be built. The outputted file will contain all the redirects that can be pasted into an existing .htaccess file. If you don't already have a .htaccess file, you could probably even have Movable Type directly output it.


The other method I had would have a similar effect, and this could be done using any webserver since the redirection is done on the visitors end and not on the server. You can use a Meta Refresh. If your not familiar with this, a Google search will give a lot of info. The main thing is the META tag as shown below in this color. This tells the browser what page to redirect to and how long to wait. By having content=0, this will happen immediately. But, since some browsers won't automatically change the page, you can also put a direct link in the actual page content. If I was to use this method, I would want to set up a new individual archive template with the following code:

<html>
<head>
<title><$MTBlogName$>: <$MTEntryTitle$></title> <META http-equiv="refresh" content="0;URL=<$MTBlogURL$><$MTArchiveDate format="%Y/%m/"$><$MTArchiveTitle dirify="1"$>.html">
</head>
This page has been moved.
<a href="<$MTBlogURL$><$MTArchiveDate format="%Y/%m/"$><$MTArchiveTitle dirify="1"$>.html">If not automatically redirected, please click here.</a>
</body>
</html>

Then, as long as this new individual archive was set up to build with the same settings as the old files, Movable Type will rebuild this template over your old files.


I had to decide what I wanted to do, use .htaccess redirects, or meta redirects. The problem with .htaccess redirects is that every page that loads on the server now has to go through that file. So I am not certain how bad that impacts the server by adding hundreds of redirects to it. But, with meta redirects, you have to first load the redirect page, then load the new page. Plus, this can be somewhat sloppy since this is done client-side, so if the page doesn't redirect, the visitor has to manually do so, and it makes the site look amateurish. The final factor that made my decision was this page about META refreshes. After reading that, I decided the Apache .htaccess redirects were the way to go.

GMail Invite

Jun/27/2004 04:19 PM

Since I have had the GMail service for about a week or so now, I now have one invite to give out. If anybody is wanting to try out this service, just post a reply here, or e-mail me. If I don't know who you are, please leave a good reason why you think you need one. :)

Yesterday was Hailey's First Birthday

Jun/25/2004 08:07 AM

Yesterday was Hailey's first birthday. We didn't do anything to celebrate as we had a party on Saturday. I guess my dad came over and saw Hailey in the evening. We are still going to make a cake and let Hailey have fun feeding herself that. Maybe we will do that tonight. Those pics should be interesting.

Switchblog

Jun/23/2004 10:05 PM

There was mention over at 1SRC that fellow moderator Joel has a blog. Switchblog. Lot's of intresting content and updated very regularly. Joel has always been very cool and he is the one that got me started on using the Opera web browser and I have never looked back. Maybe some day I will also switch over to the Mac platform, but not until a get a little more cash in my pockets.

GTray

Jun/23/2004 09:38 PM

Easy desktop access of GMail accounts with GTray. I had just come across this app and it's a pretty cool idea. I might actually get some use out of my GMail account now.
I had seen the other day a program Pop Goes the Gmail that allows you to access your GMail account from any POP3 mail client. An okay idea I guess, but seems like the great thing about GMail is the storage space on the server, and it's great organizing and search ability. If you just access your e-mail from your mail client, what's the point.
So, GTray seems like the perfect medium point. It just sit's in the system tray and tells you if you have any new messages. If you do, you can simply open a broswer tab right into your account.
GTray
GMail, here I come!

Would you have been friends with Adolf Hitler?

Jun/23/2004 09:43 AM

Would you have been friends with Adolf Hitler?

Dummkopf

Hitler hates you. Even from his grave, he is sending you hate rays.

Personality Test Results

Click Here to Take This Quiz
Brought to you by YouThink.com quizzes and personality tests.
Dang, even hating me from the grave, that's deep.

1 Year of Cameron's Thought's

Jun/22/2004 11:59 AM

One year ago today, I started this journal of mine. It has come a far way since. I have documented my life since becoming a father. Also, the site has had a number of incremental updates along the way. I've had a lot of fun with this so far and am glad I am still actively posting. I was afraid I would get bored and quit eventually, but I don't see that happening anytime in the near future.
Oh, and I also finally added a way to contact me from this page. There is a link on the right hand column, or you can just click here.

Hailey's First Birthday Party

Jun/20/2004 12:49 PM

Yesterday we celebrated Hailey's first birthday by having a party at McDonald's. She got a lot of gifts including books and dolls. She seems to like everything she got. A number of people came including many of Nickcole's family members and my parent's and siblings. Hailey's Favorite Gift There are more picture's of Hailey's party in on her website.

GMail

Jun/20/2004 12:22 PM

Just got a GMail account a couple days ago. The great people over at the Daily Gadget had a contest giving away ten invites to try out the service. I happened to have one of those invites. So I now have an address, cbulock(at)gmail.com. I'm not so worried about the spam I will get by posting that here since the spam filtering is supposed to be great. I'm not sure exactly how I will use this address since I am used to getting my e-mail in my Opera e-mail client. Going to a website to retrieve my mail seems like extra steps I wouldn't want to take. Maybe I will figure out some use for this account though. I mean, it does have a gig of storage. I was thinking, it would be great if I could upload all of my currently archived e-mail from my PC to the GMail service. I have all my e-mail back to 2000 stored in my Opera browser right now. If I could upload all that (it's certainly not a gigabyte of e-mail even though it's been accumulating over a number of years), I could then use the nice search and organizing features that GMail offers. If I could start now and be able to use that will all of my current e-mail, maybe then I would find that GMail has a lot to offer for e-mail organization.

Website Idea's

Jun/18/2004 10:15 AM

In four days, this site will celebrate it's one year anniversary. It's been a great year and I have learned a lot about modern web design. Things are a lot different now then they were back in the days of writing HTML 3 code in Notepad.
If anyone has any idea's about new things that should be added to this page, or and changed that should be made, please just post a comment below or throw me an e-mail to cameron at bulock dot com.

Which HTML tag am I?

Jun/17/2004 12:40 PM

You are <p>
You're nice and reliable, and a good friend to have in any situation. Make sure sure you've got something interesting inside though, you want to keep people coming back for more.

This Virus is Airborn

Jun/15/2004 03:45 PM

Just saw this bad news. Seems smart phones have become too smart. EPOC.Cabir is a worm that infects Nokia Series 60 phones. Busy, so can't comment much but, damn, that sucks.

Hailey's Birthday

Jun/15/2004 10:08 AM

Hailey's first birthday is soon approaching. This Saturday we are celebrating it at McDonald's at 1pm. Her actually birthday is the 24th, but this was the most convenient time to celebrate it. We bought her gifts the other day. One of them she already has, a red plastic bouncy ball. She loves that. He also got her a doll for the bath tub, a duck for the bath tub, and a couple of other things that I can't remember. She won't get those until Saturday.

XHTML Valid!

Jun/07/2004 10:12 PM

Yeah! Today, this homepage validated as 100% compatible XHTML 1.0 Transitional code.

Valid XHTML 1.0!

This was a big project as at the beginning of the day, I had over 130 errors on the page. Nothing major, as the page looks identical now as it did then. But all those errors weren't "proper" coding and I had to go through them one by one. Actually, a number of them could be eliminated by writing some code that does some code conversion on the web server end. Cause we wouldn't want to have an ampersand in a URL without using the correct code for an ampersand. That would just be wrong. :P But, as for now this page is valid. That doesn't mean it always will be as who knows if I will make sure every post I do will be completely valid code. But, the main code that this site runs on is now valid. Most of the indivdual posts should be valid too. Some posts don't have correct code inside the actual body of that posting, but that's just too bad. I'm not going back and re-writing the entire website.

My MT-Do Rank

Jun/07/2004 10:45 AM

Red Belt

Red symbolizes danger. Your knowledge lets you apply MT-Do effectively on a daily basis, but at this point you possess a will to experiment, and learn yourself new techniques. Which might lead to disastrous results. Apply your knowledge wisely and sparsely.

Take the MT-Do test

About to Fall Asleep on the Job

Jun/06/2004 10:57 PM

It's been such a slow day at work today. I am basiclly posting to keep myself busy and to prevent falling asleep. I have been on the phone only 45% of the night, meaning that over four hours of my shift I have been doing absolutly nothing. And please ignore my spelling errors. I am not at home with my constantly running spell check in the background, or using my Opera broswer with built-in spell check, or even posting via w.bloggar with it's spell check. So, I am out in the open with all my spelling incompetense for everyone to see.
But, I have been learning alot about PHP recently. It's kind of my new thing to learn. I don't know why I haven't learned it before. It's so simple, very much like BASIC. I love programming in BASIC, but it's pretty outdated now. I have tried and failed very much at C++, so I never tried Java, and Perl just scares me. I did have a time when I was doing some Visual Basic programming, but that has passed. Web pages have been what I like working with recently, and I really like using Movable Type. But, it's a static system. PHP can make the pages more dynamic. Maybe soon I will find some good uses for this knowledge. I have already put it too good use by helping with the backend of managing this website.
Well, time to go home now.

Learn to Code to the Proper Way

Jun/02/2004 01:52 PM

Not an extremely comprehensive site, but I have found it to be informative. If your like me, and still have trouble thinking of webpage design as XHTML and CSS as opposed to old school HTML, then this is the page for you.

Cliesource Has Combined With PalmOneCity to Form 1SRC

Jun/02/2004 10:03 AM

My home on the web, ClieSource is no longer. With the news of Sony suspending the Clie line, it was decided that something would need to be done with the Cliesource website as it would die eventually. Cliesource has been running since December of 2001 and I became a member there back in October of 2002. In October of 2003, Cliesource spun off a new site for PalmOne devices called PalmOneCity. I think the big reason for this was due to the release of the PalmOne Tungsten T|3 handheld. This was PalmOne's big comeback device and many Clie users switched over to it.
With the Clie line ending, it was decided that combining the communities of Cliesource and PalmOneCity into one would be a great idea. Not only that, the site now supports all PalmOS based devices, so there are now forums for the Tapwave Zodiac, the Garmin iQue, and also the Samsung, AlphaSmart and Kyocera devices.
Not only are the sites combining, other things are being changed too. For one thing, the forums have been streamlined. That are now less topics to wade through to try and find a thread you are looking for. For example, Apps, Launchers, and Games have all been combined into just Applications. They are all technically applications and are all related. There are still separate forums for the newer Clie lines, but all older Clie devices now have just one combined forum.
Also, the software powering the forums has been updated to the vBulletin 3.01 from a much older version. This means that there are nice features such as drop down menus and basically a much cleaner look. The cleaner look isn't just in the forums either. The front page is now much simpler, though currently I find the font much to small to read.
But, there is still a lot missing from this new combined site. Reggie did an amazing job throwing this all together at the last minute. I don't think he slept at all during the Memorial Day weekend. He even took Tuesday off work to finish readying the site since it was planned to be finished by midnight of the 31st, just in time for the big Clie announcement.
But, for anyone who hasn't already done so, make sure to check out the new 1SRC site and if you have any suggestions or comments, post them here.

Sony to Stop Producing Clie's

Jun/01/2004 09:17 AM

Big news in the PDA world today is that Sony is announcing that they do not have any plans to continue making Clie devices in the future. The way they are wording the announcement is that they might consider producing them again in the future, but not anytime soon. It appears that Sony is trying to streamline their operations and that would only make sense to discontinue at least the Clie or their smartphone line since the two products compete with each other in many ways. And the smartphone market has a much better sales potential.
This news is being reported at many sites such as Sony Exits U.S. Handheld Market and Sony to Suspend Clie Handheld Line. Unfortunately, ClieSource does not have any annoucement yet on this as the site has been down for the past weekend as some major changed are being made. The forum software is being updated to the newer vBulletin 3.01 and there is also a major change as a result of this announcement by Sony. It seems the updates are taking longer than planned as ClieSource was supposed to be back up before the Sony announcement, but hopefully it will soon be ready.