# URL structure ( example.com/~user/file )

**URL:** <https://www.ruby-forum.com/t/url-structure-example-com-user-file/171965>\
**Category:** Rails\
**Created:** [July 12, 2009, 12:10pm UTC](https://www.ruby-forum.com/t/url-structure-example-com-user-file/171965 "2009-07-12T12:10:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vadim\_Dashkevich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/22d042/32.png) [@Vadim\_Dashkevich](https://www.ruby-forum.com/u/Vadim_Dashkevich)\
**Post date:** [July 12, 2009, 12:10pm UTC](https://www.ruby-forum.com/t/url-structure-example-com-user-file/171965/1 "2009-07-12T12:10:24Z")

</div>

Hi  
I am new to Rails and have question. Maybe someone could help me with  
this

I want to do something like this:  
[example.com/~user/file](http://example.com/~user/file)

where user is registered username, and then goes filename owned by  
this user. So visiting this URL we can see uploaded file owned by  
specific user. And if we visit [example.com/~user](http://example.com/~user) - we can see list of  
all files uploaded by this user.

Here is my solution for routes.rb  
map.connect ‘:username/:file’, :controller =\>  
‘somecontroller’, :requirements =\> { :username =\> /~.\*/ }

But I’m not sure if it is the best (correct?) way of doing this… I  
would appreciate any help or advices.

Thanks

wbr, Vadim
