Not a developer? Go to

Ask an Expert

How can I prettify tag and keyword search URLs?

Asked by Caio
Posted May 30, 2013, in Featured.


1 Answer

Charlie Gorichanaz

Charlie Gorichanaz on October 28, 2013, 1:53 a.m. Reply

Hi Caio,

The default URL for a Movable Type text search looks like:


The default URL for an MT tag search looks like:


You could use URL rewriting to redirect from a simple URL to the complex one, hiding some of the MT internals in the process.

For example, if you’re using Apache web server, you could use a RewriteRule in an .htaccess file. You might make an index template in each blog such as this:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^tag/(.*)$ <$mt:CGIRelativeURL$><$mt:SearchScript$>?IncludeBlogs=<$mtBlogID$>&limit=20&tag=$1 [L,PT]
RewriteRule ^search/(.*)$ <$mt:CGIRelativeURL$><$mt:SearchScript$>?IncludeBlogs=<$mtBlogID$>&limit=20&search=$1 [L,PT]

Make the template publish to .htaccess, so that each blog in your system will get its own file with the correct blog ID in the InlcudeBlogs parameter.

Now you can conduct tag and text searches using URLs like:

Give an Answer

Charlie Gorichanaz

Charlie joined Six Apart as a Japan based product manager for Movable Type in February 2014 after spending two years as a developer for 601am. Previously he was the web director of The Badger Herald while studying biochemistry at the University of Wisconsin-Madison.

Twitter: @CNG

Ask An Expert