# Homepage instead of welcome page?

**URL:** <https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490>\
**Category:** Rails\
**Created:** [February 7, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490 "2006-02-07T16:27:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pezdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@pezdude](https://www.ruby-forum.com/u/pezdude)\
**Post date:** [February 7, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490/1 "2006-02-07T16:27:37Z")

</div>

Got a noob question for ya…

When I visit [http://localhost:3000/](http://localhost:3000/)  
I get the nice “Welcome to rails” page. To get to a controller I have to  
go to:  
[http://localhost:3000/controllername](http://localhost:3000/controllername)

What if I don’t want the welcome message and want / to resolve to a  
controller?

How do I set that up?

Thanks,

Dave

---

<div class="post-metadata">

**Author:** ![pezdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@pezdude](https://www.ruby-forum.com/u/pezdude)\
**Post date:** [February 7, 2006, 4:55pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490/2 "2006-02-07T16:55:28Z")

</div>

On 2/7/06, David C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How do I set that up?  
> One way to do it is to define a route for ‘/’.

As the last entry in routes.rb, add something like this:

map.connect ‘/’, :controller =\> ‘mycontroller’, :action =\> ‘someaction’

You’ll have to get rid of index.html in the /public directory or that  
file will show instead. I don’t really understand why index.html gets  
shown in that case, so if someone could explain that piece of it I’d  
appreciate it.

– James

---

<div class="post-metadata">

**Author:** ![pezdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@pezdude](https://www.ruby-forum.com/u/pezdude)\
**Post date:** [February 7, 2006, 4:57pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490/3 "2006-02-07T16:57:49Z")

</div>

> map.connect ‘/’, :controller =\> ‘mycontroller’, :action =\> ‘someaction’

Thanks, I’ll try that tonight!

---

<div class="post-metadata">

**Author:** ![pezdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@pezdude](https://www.ruby-forum.com/u/pezdude)\
**Post date:** [February 7, 2006, 5:04pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490/4 "2006-02-07T17:04:48Z")

</div>

> You’ll have to get rid of index.html in the /public directory or that  
> file will show instead. I don’t really understand why index.html gets  
> shown in that case, so if someone could explain that piece of it I’d  
> appreciate it.

Because Rails uses 404 rerouting to work, at least in most of the  
set-ups  
I’ve seen… if the file exists (in this case. index.html) it gets  
shown -  
if it doesn’t exist, the URL is passed as a 404 to the (F/S)CGI script,  
which looks at the URL, compares it to routes.rb, and picks the correct  
controller and action to run.

-Will

---

<div class="post-metadata">

**Author:** ![pezdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@pezdude](https://www.ruby-forum.com/u/pezdude)\
**Post date:** [February 7, 2006, 5:04pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490/5 "2006-02-07T17:04:51Z")

</div>

first you have to delete the index.html file in you application’s public  
directory.  
then you edit the routes.rb file and create a route that reads like the  
following:

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

---

<div class="post-metadata">

**Author:** ![pezdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@pezdude](https://www.ruby-forum.com/u/pezdude)\
**Post date:** [February 7, 2006, 7:25pm UTC](https://www.ruby-forum.com/t/homepage-instead-of-welcome-page/53490/6 "2006-02-07T19:25:41Z")

</div>

> > What if I don’t want the welcome message and want / to resolve to a  
> > controller?
> > 
> > How do I set that up?

Did you read the welcome message???

qoute: Set up a default route and remove or rename this file 😉

Mikkel B.

www.strongside.dk - Football Portal(DK)  
[nflfeed.helenius.org](http://nflfeed.helenius.org) - Football News(DK)  
ting.minline.dk - Buy Old Stuff!(DK)
