# Overriding front-end URL routing

**URL:** <https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751>\
**Category:** Radiant CMS\
**Created:** [April 24, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751 "2008-04-24T16:49:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [April 24, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751/1 "2008-04-24T16:49:40Z")

</div>

Hello,

I have a few sections in a client project that are buried a bit deep,  
which creates longer-than-desired URLs…

home

- about  
– newsroom  
— press  
— announcements  
— events

The Press section URLs looks like this…  
/about/newsroom/press/  
/about/newsroom/press/article-name/

Is there any way to override this and have tags for these third-level  
sections output and resolve to URLs like…  
/press/  
/press/article-name/

I could simply move these sections to be root-level, but I’d like to  
avoid that if possible for a few reasons.

Thanks,

- Dave

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [April 24, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751/2 "2008-04-24T17:03:13Z")

</div>

David,

You could create a special Page type that acts like a rewrite rule,  
redefining find\_by\_url so that it scopes to your “buried” page. If you  
want to go the simple route, you could rewrite the URL in your webserver  
before it gets to Radiant, but that would be uneditable from the Radiant  
interface.

Sean

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [April 24, 2008, 10:21pm UTC](https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751/3 "2008-04-24T22:21:01Z")

</div>

Sean C. wrote:

> You could create a special Page type that acts like a rewrite rule,  
> redefining find\_by\_url so that it scopes to your “buried” page. If you  
> want to go the simple route, you could rewrite the URL in your webserver  
> before it gets to Radiant, but that would be uneditable from the Radiant  
> interface.

Thanks for the ideas Sean. Using mod\_rewrite would definitely be the  
easier route, but the in-page URLs created by the radius tags would  
still appear as “/about/newsroom/press/article-name/”… Though I could  
just use custom hrefs instead of using r:link…

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [April 25, 2008, 10:55am UTC](https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751/4 "2008-04-25T10:55:47Z")

</div>

In this case you’d honestly be better off creating a press page at the  
root-level and then calling in the children of newsroom/press. Its  
really difficult to avoid long urls when it comes to news, blog or  
chronologically added pages. I’d consider this a fringe case simply  
cause most people don’t really find it necessary to manually type in  
long or even pretty urls. Your call. 🙂

David P. wrote:

> Sean C. wrote:
> 
> > You could create a special Page type that acts like a rewrite rule,  
> > redefining find\_by\_url so that it scopes to your “buried” page. If you  
> > want to go the simple route, you could rewrite the URL in your webserver  
> > before it gets to Radiant, but that would be uneditable from the Radiant  
> > interface.
> 
> Thanks for the ideas Sean. Using mod\_rewrite would definitely be the  
> easier route, but the in-page URLs created by the radius tags would  
> still appear as “/about/newsroom/press/article-name/”… Though I could  
> just use custom hrefs instead of using r:link…

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [April 25, 2008, 5:47pm UTC](https://www.ruby-forum.com/t/overriding-front-end-url-routing/135751/5 "2008-04-25T17:47:54Z")

</div>

Arik J. wrote:

> In this case you’d honestly be better off creating a press page at the  
> root-level and then calling in the children of newsroom/press. Its  
> really difficult to avoid long urls when it comes to news, blog or  
> chronologically added pages. I’d consider this a fringe case simply  
> cause most people don’t really find it necessary to manually type in  
> long or even pretty urls. Your call. 🙂

I’d agree that this is definitely a fringe case. I think if my client  
really wants to be able to advertise URLs like [website.com/press](http://website.com/press) then I  
can simply do some mod\_rewrite stuff to rewrite that to the actual URL.

Thanks for the input on this guys!

- Dave
