[typo] Redirects / and a themes question

Scott Laird scott at sigkill.org
Fri Jul 29 11:09:38 EDT 2005


On Jul 29, 2005, at 7:43 AM, gpshewan wrote:

> A very, very, very messy solution to redirecting page requests if  
> you're migrating from a blog system that uses the taxonomy
>
> hostname/year/month/day/title
>
> is to alter the routes.rb file in the config directory - look for
>
>   # allow neat perma urls
>   map.connect 'articles/:year/:month/:day', :controller  =>  
> 'articles', :action => 'find_by_date', :year => /\d{4}/, :day =>  
> nil, :month => nil
>   map.connect 'articles/:year/:month/:day/:title', :controller  =>  
> 'articles', :action => 'permalink', :year => /\d{4}/
>
> and remove 'articles' so it looks like this:
>
>   # allow neat perma urls
>   map.connect ':year/:month/:day', :controller  =>  
> 'articles', :action => 'find_by_date', :year => /\d{4}/, :day =>  
> nil, :month => nil
>   map.connect ':year/:month/:day/:title', :controller  =>  
> 'articles', :action => 'permalink', :year => /\d{4}/
>
> It's a terrible solution I know, but it's easier understanding how  
> Typo works without any documentation, than to wade through the  
> zillions of pages of tutorials for mod_rewrite, htaccess, and regex  
> to figure it out.  I find that very impressive.
>
> It's altering the core files, which I'm loathe to do.  But at least  
> I can migrate my live site without worrying that SE visitors will  
> hit 'Routing Error' pages instead of what they're looking for.

You could also add a RedirectMatch line that redirects /200(.*) to / 
articles/200$1


Scott


More information about the Typo-list mailing list