# Custom URLs in Rails

**URL:** <https://www.ruby-forum.com/t/custom-urls-in-rails/132550>\
**Category:** Rails\
**Created:** [March 21, 2008, 10:14am UTC](https://www.ruby-forum.com/t/custom-urls-in-rails/132550 "2008-03-21T10:14:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 21, 2008, 10:14am UTC](https://www.ruby-forum.com/t/custom-urls-in-rails/132550/1 "2008-03-21T10:14:55Z")

</div>

like for example [virb.com/yourURLHere](http://virb.com/yourURLHere), how is this accomplished…  
I’ve been searching for a bit but I haven’t found a solution.

Thanks

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 21, 2008, 1:24pm UTC](https://www.ruby-forum.com/t/custom-urls-in-rails/132550/2 "2008-03-21T13:24:32Z")

</div>

removed\_email\_address@domain.invalid wrote:

> like for example [virb.com/yourURLHere](http://virb.com/yourURLHere), how is this accomplished…  
> I’ve been searching for a bit but I haven’t found a solution.
> 
> Thanks

take a look at some of these solutions  
[http://www.railslodge.com/tags/all/url](http://www.railslodge.com/tags/all/url)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 21, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/custom-urls-in-rails/132550/3 "2008-03-21T19:00:17Z")

</div>

Let me rephrase…

When I say custom URL I mean… that [http://www.yoursite.com/controller](http://www.yoursite.com/controller)  
is the regular format… What if it was  
[http://www.yoursite.com/your\_screen\_name](http://www.yoursite.com/your_screen_name),  
and then route that to the profile controller and index action for  
example.

Make sense?

On Mar 21, 5:24 am, Scott A S [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 21, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/custom-urls-in-rails/132550/4 "2008-03-21T19:05:02Z")

</div>

Read up on routing. There is a file called routes.rb in your config  
directory that does this mapping for you.

This is a good place to start.

[http://www.chariotsolutions.com/slides/ete2007-black-rails-routing-roundup.pdf](http://www.chariotsolutions.com/slides/ete2007-black-rails-routing-roundup.pdf)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 22, 2008, 8:45am UTC](https://www.ruby-forum.com/t/custom-urls-in-rails/132550/5 "2008-03-22T08:45:13Z")

</div>

Thanks for the help… BTW it is my first time even using rails =)

heres’ what I finally was able to do

map.connect ‘\*path’, :controller =\> ‘profile’, :action =\> ‘index’

at the bottom of routes…

Seems to work. Cheers
