# Subdomainfu

**URL:** <https://www.ruby-forum.com/t/subdomainfu/173699>\
**Category:** Rails\
**Created:** [August 13, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/subdomainfu/173699 "2009-08-13T15:13:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [August 13, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/subdomainfu/173699/1 "2009-08-13T15:13:16Z")

</div>

Hi all,  
I am using subdomainfu plugin for subdomain in my project.I can get  
the subdomain in the url with ‘current\_subdomain’.  
But for subdomain to be accepted by my browser I need to change the /  
etc/hosts :  
127.0.0.1 localhost  
127.0.0.1 subdomain1.localhost  
127.0.0.1 subdomain2.localhost

This way I will need to enter subdomain3,subdomain4… which I can’t  
do for every user that creates account in my project.I found that I  
can’t use 127.0.0.1 \*.localhost.

Maybe I am missing something here.Can you suggest me the solution.I am  
using webrick server to host my project.

Thanks ,  
Prabesh Shrestha

---

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [August 13, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/subdomainfu/173699/2 "2009-08-13T16:55:57Z")

</div>

Prabesh Shrestha wrote:

> Hi all,  
> I am using subdomainfu plugin for subdomain in my project.I can get  
> the subdomain in the url with ‘current\_subdomain’.  
> But for subdomain to be accepted by my browser I need to change the /  
> etc/hosts :  
> 127.0.0.1 localhost  
> 127.0.0.1 subdomain1.localhost  
> 127.0.0.1 subdomain2.localhost
> 
> This way I will need to enter subdomain3,subdomain4… which I can’t  
> do for every user that creates account in my project.I found that I  
> can’t use 127.0.0.1 \*.localhost.
> 
> Maybe I am missing something here.Can you suggest me the solution.I am  
> using webrick server to host my project.
> 
> Thanks ,  
> Prabesh Shrestha

For you local machine, you will have to enter all the subdomains in  
hosts file. But when you go to production, you can modify your  
httpd.conf.

Ryan has an excellant screencast on this. Have a look at that.

But a word of warning, I did create an application using subdomainfu and  
permalink plugins. The performance was too slow. it could be because i  
was checking a subdomain against multiple tables.

---

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [August 20, 2009, 10:31am UTC](https://www.ruby-forum.com/t/subdomainfu/173699/3 "2009-08-20T10:31:10Z")

</div>

Thanks for the reply.  
I had hosted my application on Godaddy and I changed the A name there  
and now my subdomains are working all fine.  
I actually didn’t needed subdomainfu for my purpose.I had to get the  
name of subdoman and I used request.subdomains(1) for that.

Thanks,  
Prabesh Shrestha  
On Aug 13, 7:55 pm, Rails L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [August 20, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/subdomainfu/173699/4 "2009-08-20T20:07:47Z")

</div>

Hypothetically, I believe you could configure a local DNS server to  
redirect \*.localhost to your ruby server. I’m not positive though.
