# Absolute URLs

**URL:** <https://www.ruby-forum.com/t/absolute-urls/109062>\
**Category:** Rails\
**Created:** [July 11, 2007, 5:02am UTC](https://www.ruby-forum.com/t/absolute-urls/109062 "2007-07-11T05:02:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_McCarthy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a87d85/32.png) [@Kevin\_McCarthy](https://www.ruby-forum.com/u/Kevin_McCarthy)\
**Post date:** [July 11, 2007, 5:02am UTC](https://www.ruby-forum.com/t/absolute-urls/109062/1 "2007-07-11T05:02:45Z")

</div>

Hey, is there a way I can get link\_to to spit out absolute URLs,  
rather than relative URLs? I would like to do this for SEO purposes.  
Is there something that I have to subclass to get this to go, or is  
there a better hack out there to do this.

Thanks!

Kevin

---

<div class="post-metadata">

**Author:** ![Kevin\_McCarthy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a87d85/32.png) [@Kevin\_McCarthy](https://www.ruby-forum.com/u/Kevin_McCarthy)\
**Post date:** [July 11, 2007, 5:47am UTC](https://www.ruby-forum.com/t/absolute-urls/109062/2 "2007-07-11T05:47:25Z")

</div>

Kevin McCarthy wrote:

> Hey, is there a way I can get link\_to to spit out absolute URLs,  
> rather than relative URLs? I would like to do this for SEO purposes.  
> Is there something that I have to subclass to get this to go, or is  
> there a better hack out there to do this.
> 
> Thanks!
> 
> Kevin

If you are using named routes you can just used named\_route\_url instead  
of named\_route\_path.

Or: link\_to :action =\> ‘index’, :only\_path =\> false

Or I think you can add this method to application.rb

def default\_url\_options  
{ :only\_path =\> false }  
end
