Posts filed under 'site admin'

restructuring default archives

If you are new to blogging then starting a blog with movabletype may be a worthwhile read.

I looks like he ran into the same problem I did. As a side note I decided to do this on andersja’s adivce. I did decide that the depth (to the day) was overkill for my site and decided to just use /archives/year/month/title.php as my archive location.

After scanning through my access_log I noticed that there are still a sizable number of requests for some of the pages that were in the default location (i.e. /archives/000057.html). So I decided to see if I could fix this problem!

My solution is to let movabletype create an .htaccess (I am hosted on apache – I don’t know how to do this for IIS) file in the /archives/ directory that uses mod_rewrite to redirect folks to the new permalink (note: after building it once you can disable rebuilding automatically because new entries will not have been at the old location).

To do this I created a new index template with the output specified as archives/.htaccess (you should make sure you don’t already have a hand created .htaccess file in this location first).

Here is the source of the index template:

==

RewriteEngine On
<MTEntries sort_order="ascend" last_n="300000">
RewriteCond %{REQUEST_URI} <$MTEntryID pad="6"$>.html$
RewriteRule .* <$MTEntryLink$> [R,L]
</MTEntries>

==

The final .htaccess file looks like this :

==


RewriteEngine On
RewriteCond %{REQUEST_URI} 000001.html$
RewriteRule .* http://www.khakipants.org/archives/2002/08/new_site.html [R,L]
RewriteCond %{REQUEST_URI} 000002.html$
RewriteRule .* http://www.khakipants.org/archives/2002/08/old_content.html [R,L]
RewriteCond %{REQUEST_URI} 000003.html$
RewriteRule .* http://www.khakipants.org/archives/2002/08/john_earles_last_day.html [R,L]
RewriteCond %{REQUEST_URI} 000004.html$
RewriteRule .* http://www.khakipants.org/archives/2002/08/preparing_for_class.html [R,L]
...

==

Each RewriteCond line matches a given old permalink location and each RewriteRule line redirects incoming requests to the current permalink location.

Similar rules could be added to handle category archives etc.

This is just the sort of refactoring task that could potentially be handled automagically by blogging software.

updated: /archives/.htaccess has been merged with /.htaccess so that canonicalization rules will work properly. Also, I have the redirect rules returing the appropriate HTTP code. And the sample files have been updated.

7 comments March 16, 2003

htaccess cgi-bin example

I have added the following lines to the .htaccess file in my cgi-bin directory:


<FilesMatch "[^c]gi|[^g]i|[^i]$">
<Limit GET POST>
deny from all
</Limit>
</FilesMatch>

This addition prevents any files that do not end in cgi from being downloaded. All “movable type”:http://www.movabletype.org users should consider “something similar”:http://www.movabletype.org/docs/mtinstall.html#protecting%20mt.cfg.

1 comment February 19, 2003

MT-Textile plugin

I have just upgrade to “MT 2.6″:http://www.movabletype.org and am testing out the “MT-Textile plugin”:http://www.bradchoate.com/past/mttextile.php.

I have been waiting for this plugin for some time because I fell in love with StructuredText while using Zope. Time will tell if it actually sees use.

Add comment February 13, 2003

referer surfing

  • bigredswitch – he was surfing his referrer logs and saw links from my site and was inspired to link to my site and write a little more about markov text generation.
  • SteveNet – has blogrolled me right next to Donald Knuth… quite an honor.

1 comment February 5, 2003

restrict mt-search by category

I would like to be able to restrict the movable type search feature by category (not just by date-range or blog).

This would allow better integrated searching and browsing of the archives. I suppose this is not really a problem since I don’t have that many entries and the search feature ain’t to smart (keyword and regexp earching only)… but with the LSI improvements on the way maybe it will be more useful.

Add comment January 23, 2003

RSS Validation

I noticed that my site was not outputing valid RSS… so I found this page describing how to make Movable Type output valid RSS which gives some handy templates.

Add comment January 23, 2003

ErrorDocument

I have just added a customized error page.

What I did:

  1. Added the following line to my .htaccess file.
    ErrorDocument 404 /error.html
  2. created a new Index Template for error.html

Add comment January 22, 2003

more bookmarklets

Here is another collection of bookmarklets… mostly for IE but good ideas.

Add comment January 12, 2003

wiki format for MT

While scanning the MT Plugin Directory I ran across a wiki formatter for MT. I had become pretty addicted to this (called StructuredText) during my brief experimenting with Zope in 2002.

I had been searching through CPAN and only ended up finding EtText’s list of similar systems.

Add comment January 9, 2003

looking at google search APIs

I have been looking at the google search apis and it got me looking at the google query syntax.

As part of playing with this I found out that statistics are available on the web.

Also I was looking for pages that link to me and found that several do:

  • toomuchsexy – I link to them because of some doodles that they have… so I am listed as a referer at the bottom of the page.
  • the khakipants ecosystem – a really cool site that has interesting data and good blog related links
  • there are others… but this has grown tiresome… there needs to be an easy way to post a collection of links to a blog!

Add comment January 8, 2003

Previous Posts


About me

Hello, I'm Nathan Jacobs and you are looking at my blog. I am a doctoral candidate in Computer Science at Washington University in St. Louis focusing on Computer Vision. My research is in algorithms to improve the ability of computer to reason about the natural world. I also really like to make attractive and informative visualizations of complex data.

I currently update my flickr site much more frequently than this blog.

RSS twitter

Category Cloud

computer vision friend information retrieval information technology knowledge management landscaping machine learning math mozilla noise personal programming research site admin social software teaching travel ultimate frisbee usability web standards

friend

links

papers

Top Posts

Flickr Photos

Smooth

View from Mill Club 405

View from Mill Club 405

Rainbow Sunrise

Why can't I turn left?

More Photos