If you were wondering why was my site off for so long, read on. I have changed hosting providers twice, changed the design, changed the blog software, change the whole platform.
I also hacked my way to nice clean URLs you see, and if my mod_rewrite rules are correct, the old URLs should silently redirect you the new ones. Please update your bookmarks.
I have first moved the blog from company server to local ISP, VeratNet. Main reason for change was that I could now use MySQL and PHP, and thus a greater array of blog softwares. I also wanted to have nice, somewhat understandable URLs. Unfortunatelly, it appeared that Verat does not allow mod_rewrite on their servers. Even more unfortunatelly, I realized that after I lost over a week trying out various things, thinking I wrote the rules wrong (which much later on proved to be true).
So, after that, I decided to disregard my government’s “buy domestic” campaign and bought the hosting at DreamHost. Their hosting offer far outweights anything offered by serbian ISPs, I had means to pay, so the choice was easy.
Two DNS changes meant 3 weeks delay in site appearance. You see,
.yu domain registrar is not your regular domain registrar. It is not an organization at all - it is run pro-bono (at best of my knowledge) by few people from Belgrade university. Registration of .yu domain is free, for good!
Sadly, as is usually the case, being free certainly does not mean cost-free. First, only companies and organizations can register a domain (aplus.co.yu is registered on behalf of my father’s company). Second, one company can have only one domain.
All very serious policy issues in today’s world. The last issue is the one that troubles me these days. Since only a handful of people administer it, there is no guarantee at all when your request for change will be processed. It can be anything between 3 or 30 days. My request for change to DreamHost was sent on Nov. 5th, I received the email from them on 12th that the request is accepted and changes will be visible in 24h. However, the change was actually visible after almost 4 days, for unclear reasons. If I add the time for initial change to Verat, it’s close to a month.
I would be more than happy to pay something like 10€/year for my domain and have a more responsive (like under-one-business-day responsive) service, instead of having my site content offline for one month. I don’t see that happening anytime soon, though.
I went from MovableType 2.661 to WordPress 1.2.1. However, I did not like the crufted URLs WP is using by default, so I looked for other solutions. Now, it’s worth noting that I had zero-experience with PHP, WP and mod_rewrite. You can imagine that it was an interesting challenge. On the good side, I do have professional-level ASP experience, which helped a bit. :)
I read Binary Bonsai on daily basis, and one of most notable Michael’s work is Kubrick - a modification of the default WP template. I checked it inside and out. It’s an excellent work which changes a great deal of things in WP’s default. This was enough to get me started. However, the end result I have differs from Kubrick pretty much, so I would not call it a modification of K, but rather as inspired by K. One thing I did not change is the little context info at the end of each post - very nice idea and practically perfect.
So, I started a journey which lead me to several evenings and good deal of nights checking what each PHP function used in WP does. And then re-writing it so that it fits my needs.
First step was to change the default WP functions. I wanted to output nice permalinks, my own way of side links and lots of other changes. I wanted to use
/category/postname/ as URLs and this is not supported in 1.2.1. It is planned for 1.3, which is in alpha stage, meaning pretty unstable (I tried two different builds). Thus I dived into changing every WP function that outputs permalinks and then output the said stuff.
For starters, I did not want to touch any original file. Luckily, WP plugins are essentially custom functions, so I thought “ok, I’m gonna take the original functions, copy it into my plugin, and rewrite as I see fit”.
Well, in PHP you can’t override functions by simply redeclaring it again (as you can in ASP). This made things pretty hard. For e.g.
the_permalink() is used in several places, so it would be ideal for me if I could change only that one. Since that was not possible, I had to re-copy entire set of huge functions and then change only a line or two. I did the same for category links too, but not for monthly archives. I don’t see why would anyone bookmark my monthly archives, so I left them be. Also, one bit I did not changed is the URL you get after comment post - I thought it’s an overkill to recreate that functionality, so I left it be.
I have probably missed some parts - they will be ironed out as spotted.
Rewrite voodo``` objective-c
Then came the problem of writing rewrites. I have huge mental problem grasping RegExp functionality of any sort, and they are the essence of mod_rewrite. Jolly. Second, at first I had no means to even test them - I used IIS6 as local server. Looking for some testing utility, I stumbled into fantastic resource about installing and using WordPress on IIS. One thing got me jumping - ISAPI rewrite - module which brings the wonderful world of mod_rewrites to Windows-based hosting. In practically no time at all, I managed to write the entire set of rules needed for my site to operate with nice, clean URLs. Then came the hard part.
I first realized that these rules does not work with Apache’s mod_rewrite (as I understand, different matching). I was first trying out with Verat’s server, and nothing was working, which got me very frustated. Few days later, I learned why. OK, small pause, move to DreamHost (all was done in like 2h), copy all (this took a lot more than 2h), go to bed. Fresh morning start, copy .htaccess and - shit. No joy.
Did I mention that I knew nothing about the LAMP quartet? Time to call good pal Google. I first learned that .htaccess must be saved with Unix endings. Done; no joy. I tried virtually dozens of combinations and none worked. I came down to:
RewriteRule /browsers/ /adxmenu/intro/ [L]
and this was not working as well. I was so pissed off that I did not touch anything for the whole day, while awating answer from DH support - is the damn thing loaded or not. After 24h, DH responded that mod_rewrite is enabled, that I was calling it regularly, but that they can’t offer any help on specific rewrite rule problems. Understandable position, as they would be swarmed with questions about this voodoo magic.
With no light at the end of that tunnel, I decided to dig into different direction (see this rant entry for the continuation of this saga).
The site is now ready, mostly working as I wanted, and I can take my time in polishing things out. Hopefully, you will find all this work useful, so it won’t be for nothing.