# Routes: \_path vs. \_url

**URL:** <https://www.ruby-forum.com/t/routes-path-vs-url/176899>\
**Category:** Rails\
**Created:** [October 7, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/routes-path-vs-url/176899 "2009-10-07T21:16:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zakscott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b3f665/32.png) [@zakscott](https://www.ruby-forum.com/u/zakscott)\
**Post date:** [October 7, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/routes-path-vs-url/176899/1 "2009-10-07T21:16:10Z")

</div>

Routes offers you the ability to use \_path or \_url as a way to make  
links/redirect/etc throughout your site. However, I’m just wondering  
when you should use \_path and when you should use \_url. Is there a  
preference to which one to use? They seem to be fairly interchangeable  
(in my very simple app there’s no difference which one I use), but  
there have to be nuances of when to use which one, otherwise there  
wouldn’t be both options.

This isn’t a very important question, so answer at your own leisure.

Thanks,  
Zak

---

<div class="post-metadata">

**Author:** ![zakscott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b3f665/32.png) [@zakscott](https://www.ruby-forum.com/u/zakscott)\
**Post date:** [October 7, 2009, 9:22pm UTC](https://www.ruby-forum.com/t/routes-path-vs-url/176899/2 "2009-10-07T21:22:36Z")

</div>

> Routes offers you the ability to use \_path or \_url as a way to make  
> links/redirect/etc throughout your site. However, I’m just wondering  
> when you should use \_path and when you should use \_url. Is there a  
> preference to which one to use? They seem to be fairly interchangeable  
> (in my very simple app there’s no difference which one I use), but  
> there have to be nuances of when to use which one, otherwise there  
> wouldn’t be both options.
> 
> This isn’t a very important question, so answer at your own leisure.

\_path doesn’t include the “[http://yourdomain.com](http://yourdomain.com)” part. \_url does.

So if you need the protocol/domain use \_url.

For example if you’re switching b/n http and https, or between  
servers, or if you want to include a full URL in an email or for the  
user to copy…

-philip
