randys.org

Wasting your precious bandwidth since 1999

Changing Permalinks In Typo

When I switched from Wordpress to Typo, I faced the issue of keeping my Wordpress permalinks in Typo. Unfortunately, there’s no simple way of doing this. I noticed the ‘redirects’ table in the database, but I could never get it to realy do anything. So, I had to dig in and find the bit of code that controlled the permalinks in Typo.

Typo uses ‘articles’ as it’s base for all posts so I looked in config/routes.rb and found what I needed to change. As you can see from the url of this post, I use ‘content’ as the base of my permalink. So, I changed all the references of ‘articles’ to ‘content’ and all seems to be right in the world.

I changed

1
2
map.connect 'articles',
    :controller => 'articles', :action => 'index'

to

1
2
map.connect 'content',
    :controller => 'articles', :action => 'index'

and then changed

1
2
3
map.connect 'articles/:year/:month/:day',
    :controller => 'articles', :action => 'find_by_date',
    :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/

to

1
2
3
map.connect 'content/:year/:month/:day',
    :controller => 'articles', :action => 'find_by_date',
    :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/

and so on.

The only thing I haven’t gotten to work is to map the pages. I can change the ‘pages’ map, but it doesn’t act as desired. I only had 3 pages in Wordpress, so I might as well either alias them or premanent redirect in the Apache configuration.

If anybody has some insight, I’d love to here it. Also, still haven’t figured out why mod_rewrite is working like it should.

Tags: , ,

Comments are closed.

All content Copyright © Randy Sesser | Hosted by WebFaction
Entries (RSS) | Comments (RSS)