Problems with Mint on Typo

Mint is a wonderful statistics package and if you haven’t tried it out yet I seriously suggest you do.

However, when installing Mint on a Typo weblog some users may have encountered an interesting problem. When entering http://yoursite/mint you get a 404 File not Found. However if you enter http://yoursite/mint/index.php it all works fine.

The problem arises because Rails is trying to map the directory mint to a controller. We want Rails to ignore the mint directory so that we can see it. This is a rather straightforward task.

The answer can be found on the Mint forum. Paste the following code into your .htaccess file which is in the public directory.

RewriteCond %{REQUEST_URI} ^/mint.*
RewriteRule .* - [L]

That’s it. You needn’t do any more. If you want to know what is going on then keep reading.

RewriteCond

The line beginning RewriteCond defines a condition for the the RewriteRule it precedes. The condition takes two pieces of information. The first is a string to test and the second is the pattern to look for in the test string.

The %{REQUEST_URI} string is a server variable, in this case the URI entered into the browser by the user. The ^/mint.* string is the pattern to test for. The pattern specifies that the requested URI start with the string /mint and has anything following it.

RewriteRule

The next line, beginning RewriteRule specifies that the request should not be directed anywhere. The . (period), according to the mod_rewrite documentation, means “Any single character”. Therefore a request for /mint does not get redirected.

The last bit [L] stops the rewriting ending the condition.

Bibliography & Useful Links

  1. Typo (Ruby on Rails) : Configuring Mint
  2. Module mod_rewrite URL Rewriting Engine
  3. URL Rewriting Guide

If anyone has any links they think might be useful, feel free to post them. Any corrections to the article are more than welcome, I’m no expert.

Comments

RSS feed for this post

Have your say


Comment formatting

You can use Textile. HTML will be escaped.
Here are a few useful modifiers for you.

"Link (Title)":URL
*Strong*
_Emphasised_
bq. Blockquote

Trackbacks

Use the following link to trackback from your own site:
http://thomasloudon.com/articles/trackback/7