# Links always go to 'localhost'

**URL:** <https://www.ruby-forum.com/t/links-always-go-to-localhost/119489>\
**Category:** Rails\
**Created:** [November 7, 2007, 12:11pm UTC](https://www.ruby-forum.com/t/links-always-go-to-localhost/119489 "2007-11-07T12:11:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vapor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5e9695/32.png) [@vapor](https://www.ruby-forum.com/u/vapor)\
**Post date:** [November 7, 2007, 12:11pm UTC](https://www.ruby-forum.com/t/links-always-go-to-localhost/119489/1 "2007-11-07T12:11:54Z")

</div>

I am using Apache2.2 + Mongrel on my machine.  
Now I am accessing it over LAN. When I enter [http://mymachinename/myapp](http://mymachinename/myapp)  
it opens fine but when I click on any link in my rails app, it replaces  
mymachinename with localhost ([http://localhost/myapp/controller/action](http://localhost/myapp/controller/action))  
and thus I am unable to access it from remote location.

---

<div class="post-metadata">

**Author:** ![vapor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5e9695/32.png) [@vapor](https://www.ruby-forum.com/u/vapor)\
**Post date:** [November 7, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/links-always-go-to-localhost/119489/2 "2007-11-07T13:02:52Z")

</div>

This could be something to do with how you reference your hrefs in  
your rails apps.  
Could you paste one of your hrefs please?

On Nov 7, 11:11 am, “Vapor …” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![vapor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5e9695/32.png) [@vapor](https://www.ruby-forum.com/u/vapor)\
**Post date:** [November 7, 2007, 1:08pm UTC](https://www.ruby-forum.com/t/links-always-go-to-localhost/119489/3 "2007-11-07T13:08:38Z")

</div>

removed\_email\_address@domain.invalid wrote:

> This could be something to do with how you reference your hrefs in  
> your rails apps.  
> Could you paste one of your hrefs please?
> 
> On Nov 7, 11:11 am, “Vapor …” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Like this…

\<%= link\_to(‘Home’, :controller =\> ‘post’, :action =\> ‘index’) %\>
