Cool URIs must not change, ever!

Despite the infinite coolness of my new server environment I have finally decided to stop hosting my own web server. Shortly after I installed the new silent hard drive my server begun making a high pitch noise, somewhat like a television set but much more annoying. I was very close to sending the hard drive back for repair when I discovered that the noise was actually coming from the processor (an AMD Athlon XP 2800+). The noise pitch changes with the CPU load and no combination of BIOS settings or cooling has made any difference. I’ve never experienced this before and the only solution seems to be buying new hardware (again).

In the long term I don’t want the burden of running my own web server, so I have begun “outsourcing” everything. This blog has been exported to wordpress.com and I am paying $10/year to use my own domain. However, there’s no way I could keep the “blog” path in http://foolip.org/blog/, so my only solution is relocating to http://blog.foolip.org/. As we all know, cool URIs don’t (must not, ever) change, so for a while I was at a loss about how to redirect my old URLs. Eventually I found a free webhost which supports mod_rewrite and seems fairly solid. I will use this only to redirect, without serving a single file. Writing a .htaccess is very straightforward:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^foolip\.org$ [OR]
RewriteCond %{HTTP_HOST} ^www\.foolip\.org$
# http://(www.)foolip.org/blog/... -> http://blog.foolip.org/...
RewriteRule ^blog$ http://blog.foolip.org/ [R=permanent,L]
RewriteRule ^blog/(.*)$ http://blog.foolip.org/$1 [R=permanent,L]
# http://(www.)foolip.org/ -> http://blog.foolip.org/
RewriteRule ^$ http://blog.foolip.org/ [R,L]

If you are one the approximately three readers of this blog, you don’t need to do anything. Your browser and feed reader will automatically find the way (because cool URIs don’t change). However, as wordpress.com is blocked in mainland China I will have to make some special arrangements for those users, possibly using a mirror blog on wordpress.com.cn. As soon as all of that is handled, I will enable redirection and my private web server will enter eternal downtime.

Update: .htaccess made more strict, only redirecting known URLs

2 thoughts on “Cool URIs must not change, ever!

  1. Hey Philip,
    Maybe this is this post that made me find your website.
    Is R=permanent equivalent to R=301 ?
    I didn’t know you could write it this way, more explicitly.
    Yes, I’m one of your three fans. \(♥_♥)/

  2. Yeah, they’re equivalent. You can see all the options at http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

    301=permanent
    302=temp
    303=seeother

Comments are closed.