[typo] Redirects / and a themes question

gpshewan gpsnospam at gmail.com
Fri Jul 29 10:43:24 EDT 2005


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.

Gary
------
www.gpshewan.com


More information about the Typo-list mailing list