# Link\_to Subdomain and the Opposite

**URL:** <https://www.ruby-forum.com/t/link-to-subdomain-and-the-opposite/103820>\
**Category:** Rails\
**Created:** [May 10, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/link-to-subdomain-and-the-opposite/103820 "2007-05-10T17:40:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [May 10, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/link-to-subdomain-and-the-opposite/103820/1 "2007-05-10T17:40:54Z")

</div>

Hey all,

I’ve been working on a recent project that employs the use of  
account\_location to route clients to [http://username.mysite.com](http://username.mysite.com), which  
is working fine.

However, when they’re on their domain ([http://username.mysite.com](http://username.mysite.com)) I  
have links throughout the page which link to to other places on the site  
as well as there are places on the site that link you to their client  
page.

Is their any easy way to employ the subdomain attribute into a link\_to  
method?

I just want to be able to link\_to places with a subdomain and link back  
out to the main site without a subdomain.

---

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [May 11, 2007, 5:14pm UTC](https://www.ruby-forum.com/t/link-to-subdomain-and-the-opposite/103820/2 "2007-05-11T17:14:44Z")

</div>

On 10 May 2007, at 17:40, Eric A. wrote:

> Is their any easy way to employ the subdomain attribute into a link\_to  
> method?
> 
> I just want to be able to link\_to places with a subdomain and link  
> back  
> out to the main site without a subdomain.

[http://agilewebdevelopment.com/plugins/url\_for\_domain](http://agilewebdevelopment.com/plugins/url_for_domain)

Best regards

Peter De Berdt
