# Binary attachment behaviour? URL redirect behaviour?

**URL:** <https://www.ruby-forum.com/t/binary-attachment-behaviour-url-redirect-behaviour/66165>\
**Category:** Radiant CMS\
**Created:** [August 23, 2006, 6:36pm UTC](https://www.ruby-forum.com/t/binary-attachment-behaviour-url-redirect-behaviour/66165 "2006-08-23T18:36:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gui\_dos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e79b87/32.png) [@gui\_dos](https://www.ruby-forum.com/u/gui_dos)\
**Post date:** [August 23, 2006, 6:36pm UTC](https://www.ruby-forum.com/t/binary-attachment-behaviour-url-redirect-behaviour/66165/1 "2006-08-23T18:36:00Z")

</div>

I would be interested in moving some content out of the file system  
and into Radiant. I don’t mean storing it in the database, but getting  
Radiant to know about the content, and serving it with the correct  
content type.

It could be done with just a hyperlink, I know, but I have some old  
content that I am serving up by doing URL rewrites, or redirects, and  
I’d like to be able to switch to using mongrel without having 404s  
suddenly start appearing …

The problem could be solved by having radiant content that does the  
redirect, or rewriting. Or am I missing something and should I just go  
ahead and create the stub pages, and inside them write

\<r:find url="/destination/of/rewrite/redirect"\>  
\<r:content/\>  
\</r:find\>

Which will solve the issue for the redirect/rewrite. And inside that  
page, if I want to serve a PDF, I can create a link, leading straight  
to the binary file (e.g a PDF). How can I eliminate the intermediate  
page and have the content served straight after the legacy URL has  
been rewritten?

Thanks in advance!

– G.

---

<div class="post-metadata">

**Author:** ![gui\_dos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e79b87/32.png) [@gui\_dos](https://www.ruby-forum.com/u/gui_dos)\
**Post date:** [August 23, 2006, 11:08pm UTC](https://www.ruby-forum.com/t/binary-attachment-behaviour-url-redirect-behaviour/66165/2 "2006-08-23T23:08:36Z")

</div>

You can look at the page\_part\_type patch, and at the attachment  
page\_part  
which does something very similar to what you want.  
I think you’ll need a very small change to the code to get what you  
want.  
Dror

---

<div class="post-metadata">

**Author:** ![gui\_dos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e79b87/32.png) [@gui\_dos](https://www.ruby-forum.com/u/gui_dos)\
**Post date:** [August 24, 2006, 8:21am UTC](https://www.ruby-forum.com/t/binary-attachment-behaviour-url-redirect-behaviour/66165/3 "2006-08-24T08:21:18Z")

</div>

On Aug 24, 2006, at 1:35 AM, Guido S. wrote:

> It could be done with just a hyperlink, I know, but I have some old  
> content that I am serving up by doing URL rewrites, or redirects, and  
> I’d like to be able to switch to using mongrel without having 404s  
> suddenly start appearing …

When you talk about rewrites and redirects, do you mean internal  
(invisible to the client) redirects? I just slapped together a  
behaviour to do http redirects (eg 301/302 http status codes), but  
after reading your message again, I’m not sure exactly what you want  
to do. Could you give us a concrete example?

Bodhi

---

<div class="post-metadata">

**Author:** ![gui\_dos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e79b87/32.png) [@gui\_dos](https://www.ruby-forum.com/u/gui_dos)\
**Post date:** [August 25, 2006, 6:13am UTC](https://www.ruby-forum.com/t/binary-attachment-behaviour-url-redirect-behaviour/66165/4 "2006-08-25T06:13:56Z")

</div>

See my post regarding the Asset List behaviour. I decided not to have  
two types of behaviors once I figured out how to get what I want.

– G.
