# Setting home

**URL:** <https://www.ruby-forum.com/t/setting-home/116589>\
**Category:** Rails\
**Created:** [October 7, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/setting-home/116589 "2007-10-07T18:28:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![woodzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f08c70/32.png) [@woodzer](https://www.ruby-forum.com/u/woodzer)\
**Post date:** [October 7, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/setting-home/116589/1 "2007-10-07T18:28:05Z")

</div>

Hi  
Sorry for this newb question but I’m stumped and need a point in the  
right direction.

Basically I want visitors to go to /home and not /public. If they have  
never been to the site I want to redirect them to /public for a welcome  
page. I have part of this working. The problem I’m having is setting the  
/home as the default for users that have the cookie.

In my home controller I have:  
before\_filter :check\_redirect

def index  
end

def check\_redirect  
if cookies[:viewed]  
true  
else  
cookies[:viewed] = { :value =\> “1”, :expires =\> 1.year.from\_now }  
redirect\_to “/index.html”  
false  
end  
end

Thanks in advance,  
Peter

---

<div class="post-metadata">

**Author:** ![woodzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f08c70/32.png) [@woodzer](https://www.ruby-forum.com/u/woodzer)\
**Post date:** [October 7, 2007, 6:31pm UTC](https://www.ruby-forum.com/t/setting-home/116589/2 "2007-10-07T18:31:14Z")

</div>

Sorry one more bit of info. In my routes.rb I have

# Install the default route as the lowest priority.

map.connect ‘:controller/:action/:id’  
map.connect ‘’, :controller =\> “home”, :action =\> “index”
