Clean URLs for Tag & String Searches


Because Movable Type is not always installed on servers where customers have access to the servers apache config or an .htaccess file, MT’s tag and string search urls look like:

Tag Search and String Search (respectively)

These can easily be changed to more “clean” urls

To convert your Movable Type powered site to use clean urls, follow these steps:

  1. Edit your .htaccess file and add the following lines

    RewriteEngine on
    RewriteRule ^tag/(.*)$ /cgi-bin/mt/mt-search.fcgi?blog_id=1&tag=$1&limit=20
    RewriteRule ^search/(.*)$ /cgi-bin/mt/mt-search.fcgi?search=$1&IncludeBlogs=1&limit=20

    The first line RewriteEngine on turns on the Rewriting Engine. The second and third lines use RewriteRule to map the desired urls to the actual urls.

  2. Update tag links in tag clouds and on entry details by replacing <$mt:TagSearchLink encode_js="1"$> with:

    <$mt:BlogURL$>tag/<$mt:TagName normalize="1"$>
  3. Update search form.

    This requires a few more invasive changes:

    1. add class search-form to the <form> element
    2. Include a link to jquery in your header. Use a local file or remotely hosted file like this one on Google:

      <script type="text/javascript" src=""></script>
      <script type="text/javascript">
      $(document).ready(function() {
          $('.search-form').submit(function() {
              window.location.href = "/search/" + $('.search-form input:text').val();
              return false;



Do you have any idea how to alter the .htaccess files across multiple domains? I have my MT installation at, but I have two sites at and I want to have clean search URLs, but I’m not familiar enough with the subtleties of .htaccess to get these methods to work.

This really depends upon how your server is set up, but I’d suggest either looking into placing these rules in your apache config (because the .htaccess file is merely a file-based method of changing the apache configuration by directory) or using symlinks to link site .htaccess files to one main file. There are many options, ask your web host what they would recommend. Or check out Strangecode, my kickass webhost!

Thanks for this. Have to admit that I still find problems with this. Sorry, being honest here.

I, for one, would rather be able to replace the spaces in the tag names with hyphens on underlines instead of getting rid of them. I would rather see ‘free-stuff’ than ‘freestuff’ as I would think the first one would be more recognizable by the search engines. That’s a problem with the TagName tag though. It also changes the tags on the tag page. For example, my free stuff tag page.

I also noticed that the search fix no longer works either. It doesn’t work on your site here nor does it work on mine. Any chance of a fix?

Thanks, -drmike

Thanks a lot for the informative and interesting publication first of all. Actually I was looking for this information for a long time and finally have noticed this on your entry. Reading this great post I have found so many new and useful information about your manifesto, which I have not known before . I am so glad that I have bookmarked this website because I see that it is full of various and attractive information about everything. Thanks one more time for this publication, it was really interesting to read it.

Leave a comment