Archive for August, 2009

WordPress Permalinks

Posted in Software on August 21st, 2009 by Noldorin – Be the first to comment

In the process of setting of setting up my new blog, I quickly realised that by default WordPress was displaying posts and pages using query strings in the URLs, quite in contrast with the pretty URLs I was expecting from my experience hosting on WordPress.com.

To give example, in contrast to

/blog/?p=123

which was the form being shown, I was desiring something more like

/01/10/entry-title-here

Not such a terribly important matter in the scale of things; yet aesthetics is usually a worthwhile pursuit, so why not with URLs too? Moreover, the URLs then become hackable in this form.

Like many other features of the WordPress system, pretty permalinks are not enabled as default, but can be configured with a bit of effort. In this case, it required more than a bit of effort…

The problem here is caused primarily by the fact that WordPress is designed to run best on an Apache server, and not an IIS (Windows) server. In fact, pretty permalinks generally work using a .htaccess file that uses the mod_rewrite engine. Indeed, this is the file WordPress generates by default. Saying this, it is not much more difficult to confiugre IIs 7 to do the URL rewriting – the WordPress Codex page on Using Permalinks does in fact detail exactly the code required in web.config. IIS 6 is another story, unfortunately. As far as I know, many shared web servers provide the ISAPI Rewrite tool, as does my current one. Version 3 supports Apache-style .htaccess files; but alas, version 2 is all that I have available, and is probably the more widespread one at present.

After a fair bit of messing around with the httpd.ini file in the root directory of my website, I finally managed to replicate the URL rewriting functionality otherwise available on Apache servers. It’s not quite as elegant as the standard .htaccess method, but it seems to be both short and efficient. A word of warning: it has only been tested with the latest version of WordPress (2.8.4), so I cannot guarantee complete success on other versions.

[ISAPI_Rewrite]

UriMatchPrefix /blog/
RewriteCond URL (?!wp-.*).* [O]
RewriteCond URL (?!license.txt$).* [O]
RewriteCond URL (?!xmlrpc.php$).* [O]
RewriteRule .* /blog/index.php [L]

Simply past the above text into a file named httpd.ini, copy it into the root directory, and you have your pretty permalinks (providing, of course, that you have set the option in Settings > Permalinks of the admin interface.)

Relocation and Revival!

Posted in Projects, Uncategorized on August 20th, 2009 by Noldorin – Be the first to comment

In the past week I’ve finally gotten round to setting up a website under my own domain name, and with a bit of effort, relocating my entire blog from WordPress.com to my new Noldorin.com domain. Much more on the reasons for this another time; for now, I just want to say that this will be the future location of all posts. (Do kindly update your feeds list with the new address.)

A couple of improvements to the blog format, in particular:

  • It is now using the SyntaxHighlighted Evolved plugin for formatting source code, which looks noticably prettier than the old style. All code snippets in existing points have been updated.
  • I have activated the WP LaTeX plugin for displaying mathematical formulae. All though no existing posts use any proper maths, I surely intend to include some in future ones, and this shall only encourage me.

As I now have unrestricted access to the setup of my blog, I will most probably be playing around with a number of both handy and useless plugins in the coming weeks.

And finally: yes, I will be returning to a regular blogging schedule very shortly! My hiatus has lasted significantly longer than expected, mainly due to my inability to find time in the short break between the end of exams and the start of my work developing a large business application. Well, I am hoping to the get the core of my Noldorin.com website up and running pretty soon, so that will surely be an upcoming topic of my posts. Of course, some updates on the statuses of my projects are long overdue too.