# Redirecting in Mongrel

**URL:** <https://www.ruby-forum.com/t/redirecting-in-mongrel/180828>\
**Category:** Deployment\
**Created:** [July 5, 2007, 4:04pm UTC](https://www.ruby-forum.com/t/redirecting-in-mongrel/180828 "2007-07-05T16:04:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurice-gladwell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8edcca/32.png) [@maurice-gladwell](https://www.ruby-forum.com/u/maurice-gladwell)\
**Post date:** [July 5, 2007, 4:04pm UTC](https://www.ruby-forum.com/t/redirecting-in-mongrel/180828/1 "2007-07-05T16:04:26Z")

</div>

I’m setting up a website with Mongrel. One of the requirements is for  
URLs to be redirected to different files than they usually would,  
e.g.:

[http://example.com/users/show/123-king-kong](http://example.com/users/show/123-king-kong)

Would actually look for the cached file:

`public/users/show/123.html`

And not:

`public/users/show/123-king-kong.html`

as it normally would.

How would I set up such redirection with Mongrel?

Thanks in advance,  
Maurice B. Gladwell

---

<div class="post-metadata">

**Author:** ![maurice-gladwell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8edcca/32.png) [@maurice-gladwell](https://www.ruby-forum.com/u/maurice-gladwell)\
**Post date:** [July 5, 2007, 7:42pm UTC](https://www.ruby-forum.com/t/redirecting-in-mongrel/180828/2 "2007-07-05T19:42:54Z")

</div>

On Jul 5, 7:03 am, “Maurice G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> [http://example.com/users/show/123-king-kong](http://example.com/users/show/123-king-kong)  
> Would actually look for the cached file:  
> `public/users/show/123.html`  
> And not:  
> `public/users/show/123-king-kong.html`

> How would I set up such redirection with Mongrel?

I could be wrong, but I’m not sure that you can do this within mongrel  
itself. Do you have something like Apache or nginx running in front of  
mongrel? If so, it might be easiest to handle this at that layer. The  
additional benefit is that, since you would seem to be serving a  
static file anyway, you don’t have to involve mongrel/ruby in the  
serving of the file (which means your performance would increase  
greatly).

–  
Regards,

John W.

> **[John Wilger](http://johnwilger.com)**
>
> The personal website of John Wilger; Dad, Cyclist, Software Developer

---

<div class="post-metadata">

**Author:** ![maurice-gladwell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8edcca/32.png) [@maurice-gladwell](https://www.ruby-forum.com/u/maurice-gladwell)\
**Post date:** [July 5, 2007, 9:50pm UTC](https://www.ruby-forum.com/t/redirecting-in-mongrel/180828/3 "2007-07-05T21:50:13Z")

</div>

I _just_ finished setting this up. The easiest thing to do is read:

[http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/](http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)

which explains pretty much everything. The meat of the apache  
configuration is in section 3.

Kevin

On Jul 5, 10:03 am, “Maurice G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
