Removing .php in permalinks Aug 15, 2004 // 6:23 am

I made some changes about the permalink here, based on Mark Pilrim’s article about Cruft-free URLs in Movable Type. The process is quite similar like what Mark did.

Another important point also, the pages can be reached using the previous links (with the .php extention).


In short this is what I have on my MT configuration (for the main weblog):

  • Individual Archives Files: < $MTArchiveDate format="%Y/%m"$>/< $MTEntryTitle dirify="1"$>< $MTEntryKeywords dirify="1"$>
  • Monthly Archives Files: < $MTArchiveDate format="%Y/%m/index"$>
  • Monthly Archives Files (all titles): < $MTArchiveDate format="%Y/%m/all_title"$>
  • Category Archives Files: < $MTArchiveCategory dirify="1"$>
  • Category Archives Files (all title): < $MTArchiveCategory dirify="1"$>_title

To make the title shorter, I use the entry keyword variable, and if there is no keyword(s), the entry title will be dirified. It is possible because of Brad‘s MT-IfEmpty plugin.

And in the Weblog Configuration, Preferences, I give the individual entry no extension, leaving it blank.
In the template files, the main index file still has .php extention, but not files under /archives.

And in the .htaccess file, I put this following lines:

DefaultType application/x-httpd-php
RedirectMatch permanent /archives/(.*).php$ http://warnadunia.net/archives/$1

So, /some_entry_permalink.php will redirected to /some_entry_permalink. Yes, because (I agree with this) changing the URI is a bad idea.

So, some visitors might try to put a trailing slash, like: /some_entry_permalink/, but I think it will be no problem.

Well, just an experiment. So, how’s your permalinks?

  • http://coretmoret.web.id amal

    It is not easy for me: the keywords box is used to supply the real keywords I use for HTML, for . So I can not use that box for lying such permalink. The other problem with changing tag for permalink is: because I “rebuild all” my site every day (using cron), I have to deal with enormous amount of RewriteRule in my Apache.

    Now I am also considering reconstruct my permalink, but I still search an elegant idea to apply.

  • amal

    Ah, so… there is something missing in my previous comment. It should be:

    the keywords box is used to supply the real keywords I use for HTML, for <meta name=”keywords” …>.

  • Lhukie

    Aku gapake MT… *hidup blogger*

    cuma mo bilang : Merdeka !!! :-*

blog comments powered by Disqus

Live search:

I'm @thomasarie on Twitter

Subscribe to RSS

Enter your email address and get recent updates sent to your email in the morning.

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Designed by Thomas Arie. Icon character by Fredy Sujono.