# Map.rewrite problem - remap a file request to a url

**URL:** <https://www.ruby-forum.com/t/map-rewrite-problem-remap-a-file-request-to-a-url/179535>\
**Category:** Rails\
**Created:** [November 27, 2009, 1:42pm UTC](https://www.ruby-forum.com/t/map-rewrite-problem-remap-a-file-request-to-a-url/179535 "2009-11-27T13:42:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [November 27, 2009, 1:42pm UTC](https://www.ruby-forum.com/t/map-rewrite-problem-remap-a-file-request-to-a-url/179535/1 "2009-11-27T13:42:42Z")

</div>

I have a rewrite i need to do. I have a flash app that’s asking for a  
file with this location:

> > /millionaire/millionaire\_quizzes/123/data/questions.XML

Instead, i want it to load the xml which is generated for this url:

> > /millionaire/millionaire\_quizzes/123.xml

I’m having problems getting the rewrite working. i thought this would  
do it:

> > map.rewrite “/millionaire/millionaire\_quizzes/:id/data/questions.XML”,  
> > “/millionaire/millionaire\_quizzes”, :type =\> “text/xml”

But i get this error:

ActionController::MissingFile (Cannot read file  
/home/max/work/e\_learning\_resource/trunk/public/millionaire/millionaire\_quizzes):  
/var/lib/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/streaming.rb:76:in  
`send_file' /vendor/plugins/redirect_routing/lib/redirect_routing_controller.rb:16:in`rewrite’

It looks like it’s still expecting to get a file back. Do i need to set  
something in the :disposition option maybe?

thanks, max

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [November 27, 2009, 3:12pm UTC](https://www.ruby-forum.com/t/map-rewrite-problem-remap-a-file-request-to-a-url/179535/2 "2009-11-27T15:12:21Z")

</div>

I figured it out, i used a connect instead. Not sure if this is the  
best solution so still happy to receive advice 🙂

map.connect “/millionaire/millionaire\_quizzes/:id/data/questions.XML”,  
:controller =\> ‘millionaire\_quizzes’, :action =\> ‘show’, :format =\>  
“xml”
