# Domain to sub domain pointer

**URL:** <https://www.ruby-forum.com/t/domain-to-sub-domain-pointer/178352>\
**Category:** Rails\
**Created:** [November 3, 2009, 12:03pm UTC](https://www.ruby-forum.com/t/domain-to-sub-domain-pointer/178352 "2009-11-03T12:03:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [November 3, 2009, 12:03pm UTC](https://www.ruby-forum.com/t/domain-to-sub-domain-pointer/178352/1 "2009-11-03T12:03:20Z")

</div>

Hello Friends,

I have a requirement where a user can configure there own domain.

For example

We will provide a subdomain to every user who will get registered to our  
site.

For e.g [xyz.example.com](http://xyz.example.com)

But if the user already have a domain for example [xyz.com](http://xyz.com) he can point  
that  
subdomain to [xyz.example.com](http://xyz.example.com).

So when someone access [xyz.com](http://xyz.com) internally he should redirect to  
[xyz.example.com](http://xyz.example.com).

Please help me to configure the system

Thanks

Abhis

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [November 3, 2009, 4:07pm UTC](https://www.ruby-forum.com/t/domain-to-sub-domain-pointer/178352/2 "2009-11-03T16:07:24Z")

</div>

Maybe use awesome plugin:

> **[GitHub - mbleigh/subdomain-fu: A new plugin approach to attempting to solve...](https://github.com/mbleigh/subdomain-fu)**
>
> A new plugin approach to attempting to solve the usage of subdomains in linking and routing in Rails projects. - GitHub - mbleigh/subdomain-fu: A new plugin approach to attempting to solve the usag...

Letâ€™s say my domain is â€˜intridea.comâ€™. Here are some examples of the use  
of  
the :subdomain option:

url\_for(:controller =\> “my\_controller”,

```
    :action => "my_action",
    :subdomain => "awesome") # =>

```

[http://awesome.intridea.com/my\_controller/my\_action](http://awesome.intridea.com/my_controller/my_action)

2009/11/3 Abhishek shukla [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Abhis
> 
> >

–  
tommy xiao  
E-mail: xiaods(AT)[gmail.com](http://gmail.com)

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [November 5, 2009, 11:04am UTC](https://www.ruby-forum.com/t/domain-to-sub-domain-pointer/178352/3 "2009-11-05T11:04:56Z")

</div>

hello tommy

Thanks for your reply, But I guess I should be more detail with my  
requirement.

We are providing a service where a user can sign up and have there blog  
and  
by default we will provide a separate subdomain to ever user  
[myblog.blogexample.com](http://myblog.blogexample.com) but if user wants they can replace with there  
domain

for e.g.  
[myblog.com](http://myblog.com) which will be actually a pointiing to [myblog.blogexample.com](http://myblog.blogexample.com)

thanks for any help.

Thanks  
Abhishek S.
