Movable Type Tags – Simplifying Search URLs

So now that Movable Type supports Tags, I'm going to have to re-architect the way I've done my categories.

I wanted to make this work a little more like Technorati with their tag search, where you can just go type in www.technorati.com/tags/[tag of interest].

With a little searching on the web, I found this page in Movable Type's beta documentation. Paraphrasing here for continuity:

This assumes you're using Apache, and have mod_rewrite installed and working. You need to simply put the following into your document root's .htaccess file:

RewriteEngine on
RewriteRule tag/(.+) /mt/mt-search.cgi?tag=$1&blog_id=1

Jay goes on to note that if you're using Movable Type templates to create the .htaccess file, you can use Movable Type's <$MTBlogID$> variable to automate your blog_id variable.


Posted

in

by

Comments

4 responses to “Movable Type Tags – Simplifying Search URLs”

  1. Icyshard Avatar

    Hey, I came across your site in a Google search. I’m trying to make my tag URLs pretty, but for some reason, I’m not having any luck with the mod_rewrite. I know it’s active on my server, so I was just wondering if there was anything specific you did to get it to work on yours? (Did you put it in site root, or blog root, modify any variables, etc.)

    Thanks for any help you can provide!

  2. Marius Avatar

    I put the .htaccess file in my DocumentRoot, which happens to be the same as my blog root.

    What kind of error are you getting?

  3. Icyshard Avatar

    I put it in my site root. I have 2 blogs, one in a directory called “blog” and one in a directory called “photolog” (which is actually a subdirectory photolog.icyshard.com). I want to use the tags only on the photolog, and it all works fine with the ugly cgi links. When i put in the rewrite code (changing the blog_id to the id of my photolog) nothing happens and try to go to the pretty link, (which I assume should just be http://www.icyshard.com/tag/name-of-tag) I get a 404 error.

  4. Marius Avatar

    Are you sure you put the file in the photolog directory? When I go to http://www.icyshard.com/photolog/.htaccess I get a 404 error.

    (Of course, visiting http://photolog.icyshard.com/.htaccess gives me a 403 error, which I would expect to be correct)

    Can you post the entire contents of your .htaccess? Can you make sure that the RewriteRule entry didn’t word wrap? Did you make sure that RewriteEngine is set to On in your .htaccess? Do you have “AllowOverride Fileinfo” (or equivalent) set in your Apache configuration?