views:

342

answers:

2

Hi all,

I use the subdomain to indicate the product eg. nexusphone.site.com . When a user types in that url I render the product/show view of that product. Users can also use domainnames eg www.nexusphone or nexusphone.com to render that product/show view.

www.site.com or site.com should render the home view which explains what my site is about.

I basically want to render the home view when www.site.com or site.com is entered. In all other cases I want to render the product/show view.

In my routes I have

map.club_root '', :controller => 'products', :action => 'show', :conditions => { :subdomain => /.+/ }
map.root :home

This works for the nexusphone.site.com example but not for nexusphone.com. Then it renders the home view.

Someone knows how I can solve this?

Thanks

A: 

hey,

maybe the problem is not related with rails...

hope the following link will help

http://www.boutell.com/newfaq/creating/withoutwww.html

cheers

denisjacquemin
A: 

With a small code change subdomain-fu can also route based on domain and host. This blog post explains it in more detail.

Tarscher