[typo] Redirects / and a themes question
gpshewan
gpsnospam at gmail.com
Fri Jul 29 14:18:44 EDT 2005
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.
Gary
------
www.gpshewan.com
More information about the Typo-list
mailing list