[typo] Redirects

Mike Purvis mike at uwmike.com
Wed Sep 7 13:15:31 EDT 2005


Okay, so I'm tempted to just dash off a quick PHP to make the redirects, 
but I might as well start getting used to the Rails Way.

I generated a new controller called "forward". And in routes.rb, I added 
this:

  # forward old urls
  map.connect 'archive/:title',
    :controller => 'forward', :action => 'forward_old'

I established it's making it to ForwardController:

class ForwardController < ApplicationController
  def forward_old
    render_text 'Hello'
  end
end

However, I'm unsure how to access the "title" that I've passed in, or 
indeed how to query the articles table-- one belonging to a different 
controller. Am I going about this all backwards? Should it be a new 
action in the Articles controller instead, so that the table I need is 
just "there"?

Thanks,

Mike


Kevin Ballard wrote:

> Heh, I have some custom code in my install that makes my old MT  
> permalinks (/archives/2003/06/21/some_random_article.html) redirect  
> to the new Typo permalinks, but Tobias (rightfully) didn't want it in  
> the main codebase.
>
> However, part of this code involves a port of a perl file taken from  
> MovableType, which means it's covered under the MT license (as a  
> derivative work) and thus I can't distribute it.



More information about the Typo-list mailing list