Overriding front-end URL routing

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

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

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…

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. :slight_smile:

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…

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. :slight_smile:

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 then I
can simply do some mod_rewrite stuff to rewrite that to the actual URL.

Thanks for the input on this guys!

  • Dave