# SEO url's with nesting pages

**URL:** <https://www.ruby-forum.com/t/seo-urls-with-nesting-pages/125918>\
**Category:** Rails\
**Created:** [January 13, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/seo-urls-with-nesting-pages/125918 "2008-01-13T19:48:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@stefan](https://www.ruby-forum.com/u/stefan)\
**Post date:** [January 13, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/seo-urls-with-nesting-pages/125918/1 "2008-01-13T19:48:42Z")

</div>

In my current project we have a problem regarding to the prefered URLS  
and the routing which come with it.

For now I have one model Page that acts\_as\_tree, thus has a belongs\_to  
and has\_many relations with itself. This is of course very nice  
because then you can create a nice tree like this.

Page 1  
|- subpage 1.1  
|- subsubpage 1.1.1  
|- subsubpage 1.1.2  
|- subpage 1.2

Of course this is a very logic way of nesting pages. Now the problem  
lies within the SEO url we want for these pages.

With permalink\_fu it is no problem for creating urls like  
[http://localhost.com/pages/page\_1](http://localhost.com/pages/page_1) or  
[http://localhost.com/pages/subpage\_1\_1](http://localhost.com/pages/subpage_1_1).  
But the last one isn’t what we want… the last one should be  
[http://localhost.com/pages/page\_1/subpage\_1\_1](http://localhost.com/pages/page_1/subpage_1_1) or even  
[http://localhost.com/pages/page\_1/subpage\_1\_1/subsubpage\_1\_1\_2](http://localhost.com/pages/page_1/subpage_1_1/subsubpage_1_1_2) for the  
next level

I can’t come up with a routing that makes this possible… Is there a  
way to achieve this? and is it still possible to keep the application  
RESTful?

Thanks in advance,

Stefan
