# Public/index.html

**URL:** <https://www.ruby-forum.com/t/public-index-html/88413>\
**Category:** Rails\
**Created:** [March 10, 2007, 6:51pm UTC](https://www.ruby-forum.com/t/public-index-html/88413 "2007-03-10T18:51:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 10, 2007, 6:51pm UTC](https://www.ruby-forum.com/t/public-index-html/88413/1 "2007-03-10T18:51:21Z")

</div>

Hi –

I’m very new to rails. I have a couple of what have to be  
very naive questions. I don’t know what else to do but to  
ask them. I will use separate posts.

The default page is public/index.html. Presumable this  
would be what one would use as a home page. I don’t  
understand why it’s setup as an html page (rather than  
an rhtml page). I would think that it would be a common  
requirement to have embedded ruby code in the home  
page. Presumably I’m either missing something or there  
is an easy work around. Could someone please square  
me away? Thanks.

```
    ... doug
```

---

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 10, 2007, 8:03pm UTC](https://www.ruby-forum.com/t/public-index-html/88413/2 "2007-03-10T20:03:31Z")

</div>

Hi Doug,

> The default page is public/index.html. Presumable this  
> would be what one would use as a home page. I don’t  
> understand why it’s setup as an html page (rather than  
> an rhtml page). I would think that it would be a common  
> requirement to have embedded ruby code in the home  
> page.

Only pages within the application space get processed via Rails and thus  
have their eRb processed into html. The /public directory in which all  
browsers look for index.html is not within the Rails application space.  
You  
can override this. Tom F. posted the following recently in response  
to a  
similar query.

> I usually have a controller I call ‘main’, with an action called  
> ‘index’ for my home page. Then I have a named route:
> 
> map.home ‘/’, :controller =\> ‘main’, :action =\> ‘index’
> 
> I can add my About, Terms and Conditions, and other random  
> pages that don’t fit anywhere else in the main controller.

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 11, 2007, 2:58am UTC](https://www.ruby-forum.com/t/public-index-html/88413/3 "2007-03-11T02:58:44Z")

</div>

doug wrote:

> requirement to have embedded ruby code in the home  
> page. Presumably I’m either missing something or there  
> is an easy work around. Could someone please square  
> me away? Thanks.

To render an .rhtml page requires the presense of a controller and a  
default “/” route pointing to that controller, neither of which are  
present when you run "rails ". That is why it’s a static HTML  
page.

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 10, 2007, 10:29pm UTC](https://www.ruby-forum.com/t/public-index-html/88413/4 "2007-03-10T22:29:05Z")

</div>

Everything under the public directory such as static html pages, images,  
javascripts and stylesheets will be served up to the browser by the  
webserver. It is there as a static file so that you can verify that you  
have  
installed everything properly on your machine. When you run the  
script/server on your machine, you will see the Welcome aboard, You are  
riding on Rails welcome screen. You can click on the environment setup  
which  
uses AJAX calls to show details about your environment. My environment  
setup  
looks like this:

Ruby version1.8.5 (powerpc-darwin8.8.0)RubyGems version0.9.2Rails  
version  
1.2.2Active Record version1.15.2Action Pack version1.13.2Action Web  
Service  
version1.2.2Action Mailer version1.3.2Active Support  
version1.4.1Application  
root/Users/balaparanj/work/my\_appEnvironmentdevelopmentDatabase  
adaptermysql

---

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 11, 2007, 11:21pm UTC](https://www.ruby-forum.com/t/public-index-html/88413/5 "2007-03-11T23:21:05Z")

</div>

> > I usually have a controller I call ‘main’, with an action called  
> > ‘index’ for my home page. Then I have a named route:
> 
> > map.home ‘/’, :controller =\> ‘main’, :action =\> ‘index’

Works great. They also have an example of how to do it using  
a regular route (as opposed to a named route) in routes.rb. In  
both cases one has to remember to trash public/index.html for  
the routing to work. Thanks for the input.

```
  ... doug
```
