Removing .php in permalinks
in Movable Type, Webdev
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?
This entry receives 3 comments.
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.
Aug 15, 2004 at 11:56 pm
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” …>.
Aug 16, 2004 at 12:11 am
Lhukie
Aku gapake MT… *hidup blogger*
cuma mo bilang : Merdeka !!! :-*
Aug 17, 2004 at 6:41 am