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
From scott at sigkill.org  Fri Jul 29 11:09:38 2005
From: scott at sigkill.org (Scott Laird)
Date: Fri Jul 29 11:03:59 2005
Subject: [typo] Redirects / and a themes question
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>


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
From kevin at sb.org  Fri Jul 29 14:17:55 2005
From: kevin at sb.org (Kevin Ballard)
Date: Fri Jul 29 14:12:28 2005
Subject: [typo] Redirects / and a themes question
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>

On Jul 29, 2005, at 11:09 AM, Scott Laird wrote:

>> 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

Of course, both of these solutions depend on TextPattern and Typo  
using the same algorithm to change a title into a permalink. The  
title "a post" shows up the same in both, but how does TextPattern  
deal with non-ascii characters? How would the permalinks compare with  
the following contrived title: "foo-bar 2.7 and Bob's $$ (money)" ?

-- 
Kevin Ballard
[EMAIL PROTECTED]
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/0a1aed45/smime.bin
From gpsnospam at gmail.com  Fri Jul 29 14:18:44 2005
From: gpsnospam at gmail.com (gpshewan)
Date: Fri Jul 29 14:12:41 2005
Subject: [typo] Redirects / and a themes question
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>


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
From kevin at sb.org  Fri Jul 29 14:39:38 2005
From: kevin at sb.org (Kevin Ballard)
Date: Fri Jul 29 14:34:11 2005
Subject: [typo] Redirects / and a themes question
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>

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
[EMAIL PROTECTED]
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
From chris at codeintensity.com  Fri Jul 29 14:55:10 2005
From: chris at codeintensity.com (Christopher Bailey)
Date: Fri Jul 29 14:49:54 2005
Subject: [typo] Need help upgrading
In-Reply-To: <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>

Thanks everyone for your help.  I finally figured out why it wasn't working.
If any blog entry didn't have a [valid] value in the "text_filter" column of
the articles table, then the migration would blow up when it got to that
record.  Fixing that enabled the migration to work fine.  For both my blogs,
I happened to have a record that had an empty value (not null though) in
that column.

Now that I've upgraded, I'd like to say great work on the various changes!
The new Sidebar stuff is very cool, amongst other things.  Also, assuming
you don't have funky data in your DB, the upgrade process was very slick.


On 7/28/05 1:53 AM, "Robin Bowes" <[EMAIL PROTECTED]> wrote:

> Kevin Ballard wrote:
>> In a production environment, you want to do `rake migrate
>> RAILS_ENV=production`. Without that, you're migrating the development
>> environment, which isn't very useful.
> 
> So, to recap, the process to upgrade would be:
> 
> svn update
> rake migrate  RAILS_ENV=production
> 
> Job done?
> 
> I did this:
> 
> svn update
> Browse to http://typo.robinbowes.com/admin
> Login
> Run the migrations
> Clear page cache
> Restart apache
> 
> Is there anything else I need to do? Like removing any static files, etc.?
> 
> R.

Reply via email to