# Very Noob Question: index.html

**URL:** <https://www.ruby-forum.com/t/very-noob-question-index-html/106162>\
**Category:** Rails\
**Created:** [June 6, 2007, 11:22pm UTC](https://www.ruby-forum.com/t/very-noob-question-index-html/106162 "2007-06-06T23:22:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![newby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/58956e/32.png) [@newby](https://www.ruby-forum.com/u/newby)\
**Post date:** [June 6, 2007, 11:22pm UTC](https://www.ruby-forum.com/t/very-noob-question-index-html/106162/1 "2007-06-06T23:22:31Z")

</div>

Hi,

I have a very noob question. I just started on RoR this week, glad to be  
on board. I’m just wondering where I edit the first page when people  
come to the site, index.html. There seems to be one in the public  
folder. However, how do I make that a dynamic page?

Thanks

---

<div class="post-metadata">

**Author:** ![newby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/58956e/32.png) [@newby](https://www.ruby-forum.com/u/newby)\
**Post date:** [June 6, 2007, 11:27pm UTC](https://www.ruby-forum.com/t/very-noob-question-index-html/106162/2 "2007-06-06T23:27:53Z")

</div>

Rename or remove that file and add a default route.

Look in your routes.rb file. You’ll see something like this…

# You can have the root of your site routed by hooking up ‘’

# – just remember to delete public/index.html.

# map.connect ‘’, :controller =\> “index”

Uncomment that and generate an index controller or whatever name you  
like.

–  
James M.

---

<div class="post-metadata">

**Author:** ![newby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/58956e/32.png) [@newby](https://www.ruby-forum.com/u/newby)\
**Post date:** [June 6, 2007, 11:42pm UTC](https://www.ruby-forum.com/t/very-noob-question-index-html/106162/3 "2007-06-06T23:42:57Z")

</div>

Hi –

On Wed, 6 Jun 2007, Newby wrote:

> Hi,
> 
> I have a very noob question. I just started on RoR this week, glad to be  
> on board.

Welcome!

> I’m just wondering where I edit the first page when people  
> come to the site, index.html. There seems to be one in the public  
> folder. However, how do I make that a dynamic page?

Rails uses its routing system to figure out what to do given a  
particular URL. That applies even when the URL is empty: you have to  
register a routing rule that says what to do in response to the empty  
URL.

To do this, look inside the file config/routes.rb. You’ll see a  
section like this:

# You can have the root of your site routed by hooking up ‘’

# – just remember to delete public/index.html.

# map.connect ‘’, :controller =\> “welcome”

You want to uncomment the third line, and customize it to correspond  
to whatever controller/action combo you want triggered by the empty  
URL. (The action defaults to “index”, so the example above triggers  
the index action of the welcome controller.)

So a typical case might look like:

map.connect ‘’, :controller =\> “main”, :action =\> “top”

or

map.connect ‘’, :controller =\> “main” # default to “index” action

etc.

And, like it says, don’t forget to delete public/index.html 🙂

David

–  
Q. What is THE Ruby book for Rails developers?  
A. RUBY FOR RAILS by David A. Black ([Ruby for Rails](http://www.manning.com/black))  
(See what readers are saying! [http://www.rubypal.com/r4rrevs.pdf](http://www.rubypal.com/r4rrevs.pdf))  
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?  
A. Ruby Power and Light, LLC ([http://www.rubypal.com](http://www.rubypal.com))

---

<div class="post-metadata">

**Author:** ![newby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/58956e/32.png) [@newby](https://www.ruby-forum.com/u/newby)\
**Post date:** [June 6, 2007, 11:50pm UTC](https://www.ruby-forum.com/t/very-noob-question-index-html/106162/4 "2007-06-06T23:50:57Z")

</div>

The index.html that is in public is just a place holder. Delete that  
file and add a route in routes.rb for the “/” path to point to a  
controller and action you want for the default content.

I recommend getting “Agile Web D. with Rails” which starts  
with a short and to the point tutorial that gets an application up and  
running, then dives into more detail on each component of an  
application.

Michael
