# Change default index page

**URL:** <https://www.ruby-forum.com/t/change-default-index-page/166950>\
**Category:** Rails\
**Created:** [May 1, 2009, 10:18am UTC](https://www.ruby-forum.com/t/change-default-index-page/166950 "2009-05-01T10:18:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpyong27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cpyong27](https://www.ruby-forum.com/u/cpyong27)\
**Post date:** [May 1, 2009, 10:18am UTC](https://www.ruby-forum.com/t/change-default-index-page/166950/1 "2009-05-01T10:18:03Z")

</div>

Hello,  
Not sure if anyone can help me here. I have a page which I want to  
make it the index page.

The page is [http://www.myweb.com:3000/bin/myindex.mxml](http://www.myweb.com:3000/bin/myindex.mxml).

Yes, you can probably tell it’s a Adobe Flex component - myindex.mxml.  
I’m combining Flex and RubyOnRails.

My question is: Is there a way to make that the default page to  
display when people browse to [http://www.myweb.com:3000/](http://www.myweb.com:3000/).

Apreciate if anyone could help.

Regards,  
Jay

---

<div class="post-metadata">

**Author:** ![cpyong27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cpyong27](https://www.ruby-forum.com/u/cpyong27)\
**Post date:** [May 1, 2009, 10:59am UTC](https://www.ruby-forum.com/t/change-default-index-page/166950/2 "2009-05-01T10:59:05Z")

</div>

Jacob Y. wrote:

> Hello,  
> Not sure if anyone can help me here. I have a page which I want to  
> make it the index page.
> 
> The page is [http://www.myweb.com:3000/bin/myindex.mxml](http://www.myweb.com:3000/bin/myindex.mxml).
> 
> Yes, you can probably tell it’s a Adobe Flex component - myindex.mxml.  
> I’m combining Flex and RubyOnRails.
> 
> My question is: Is there a way to make that the default page to  
> display when people browse to [http://www.myweb.com:3000/](http://www.myweb.com:3000/).
> 
> Apreciate if anyone could help.
> 
> Regards,  
> Jay

Define a default route in routes.rb

ie  
map.root ‘/bin/myindex.mxml’

…at least, thats how you would define a default controller/action as  
the root, so I think it will probably apply to a static resource.

---

<div class="post-metadata">

**Author:** ![cpyong27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cpyong27](https://www.ruby-forum.com/u/cpyong27)\
**Post date:** [May 1, 2009, 11:38am UTC](https://www.ruby-forum.com/t/change-default-index-page/166950/3 "2009-05-01T11:38:02Z")

</div>

Not sure that the previous solution will work.

If the page is dynamic then, point root to the right controller and  
action.  
map.root :controller =\> ‘yourcontroller’, :action =\> ‘youraction’

If it’s static then you’ll better think twice if you need it, and if  
you realy need then try one of the following things:

1. Symlink it to the /index.html
2. Try Apache DirectoryIndex, or nginx index directives, although I’m  
not sure that they allow setting the default page in another  
directory.
3. Use URL rewriting on the webserver level

Dmitry
