[typo] Redirects / and a themes question

Kevin Ballard kevin at sb.org
Fri Jul 29 14:39:38 EDT 2005


On Jul 29, 2005, at 2:18 PM, gpshewan wrote:

> On 29 Jul 2005, at 16:09, Scott Laird wrote:
>
>>
>> You could also add a RedirectMatch line that redirects /200(.*)  
>> to /articles/200$1
>>
>>
>
> Ah that's the thing though, I couldn't figure out/get to work any  
> kind of redirect.  I tried a tonne of different redirects and regex  
> but nothing seemed to work, so in the end it was easier to look at  
> how Typo was handling it.
>
> Actually I've been looking at it again, and tried something that  
> isn't as 'destructive'.  I duplicated the routing information that  
> was there and ended up with this:
>
>   # 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}/
>   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}/
>
> That means that I keep Typos form of clean urls for future posts,  
> and yet any requests that come from SE's for old posts are still  
> handled okay.
>
> Don't see any issues with it in testing and I like it better than  
> the other solution.

The problem is ideally, the old URLs should be redirected to the new  
ones. You can do that with mod_rewrite, but to do it with routes  
you'd have to add a new method to a controller as well to do the  
redirect.

-- 
Kevin Ballard
kevin at sb.org
http://www.tildesoft.com
http://kevin.sb.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2378 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/typo-list/attachments/20050729/7e579385/smime.bin


More information about the Typo-list mailing list