Rewriting URLs [13.03.2009]

You can now define regular expressions for redirecting certain URLs to other URLs. This has been possible with the 'URL Rewrites' sidebar box in the Settings tab, but it was always a bit hit and miss, and only invoked when Blueprint would ordinarily return a 404 response.

Now URL rewriting (or 301 redirecting, more precisely) occurs when much earlier in route recognition, before page slugs are checked. So you can override page slugs to point particular URLs elsewhere. 'Elsewhere' can be some other URL on the same site, a subdomain, or anywhere on the web.

To set up a URL rewrite, add it to lib/rules.rb in your site directory:

rewrite /^\/artists\/\d+-(.*)$/ => '/artists/\1'

See the default rules.rb file for additional details.

Only the comment field is required. Omitting the ID fields increases your risk of being mistaken for spam.

Preview or