# Routes and urls: www.example.com

**URL:** <https://www.ruby-forum.com/t/routes-and-urls-www-example-com/175802>\
**Category:** Rails\
**Created:** [September 20, 2009, 5:04am UTC](https://www.ruby-forum.com/t/routes-and-urls-www-example-com/175802 "2009-09-20T05:04:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [September 20, 2009, 5:04am UTC](https://www.ruby-forum.com/t/routes-and-urls-www-example-com/175802/1 "2009-09-20T05:04:41Z")

</div>

I’m building an application that stores links, but i’ve run into a  
problem with routing. If my routes.rb looks like this:

map.widget ‘/widget/show/:url’, :controller =\> “widget”, :action =\>  
“show”

then when i go to /widget/show/www.example.com then i get an error. If  
i change the route to:

map.widget ‘/widget/show’, :controller =\> “widget”, :action =\> “show”

and i enter in /widget/show?[url=www.example.com](http://url=www.example.com) then everything works  
great, but i’m currious if there is anything i can do to make the first  
routing method work?

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [September 20, 2009, 8:23pm UTC](https://www.ruby-forum.com/t/routes-and-urls-www-example-com/175802/2 "2009-09-20T20:23:58Z")

</div>

You might want to try:

map.widget ‘/widget/show/\*url’, :controller =\> ‘widget’, :action =\>  
‘show’

and see if that works. I seem to recall that the dots are the issue,  
as the router typically uses them to separate formats from request  
params.

–Matt J.

On Sep 19, 11:04 pm, Richard S. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [September 22, 2009, 4:49am UTC](https://www.ruby-forum.com/t/routes-and-urls-www-example-com/175802/3 "2009-09-22T04:49:09Z")

</div>

That Worked!! Now it looks even better than it did before, I can go to  
/widget/show/www.example.com without that nasty ?url= . Good Work!! I  
also have to admit that i should have RTFM  
[Rails Routing from the Outside In — Ruby on Rails Guides](http://guides.rubyonrails.org/routing.html) mentions this technique,  
apparently its called Route Globbing and not found until a few minutes  
of reading. Thanks again for your help Matt!!
