Eliminate leading-directory name from URL's

Hello,

Is there a way to get Rails to ignore a leading-directory in a URL
(either in the environment.rb or routes.rb file)?

For example, I’d like all requests to: http://domain.com/blah/products
to get processed as [app]/products

I don’t have access to use mod_redirect, and right now Rails keeps
looking at “blah” to be a controller. I’d simply like it always
stripped out of the URL.

Any suggestions? Thank you!

-Jason

that’s not a leading directory, it’s the rails routing path which
follows the convention :controller/:action/:id. Say you were to strip
out the controller portion and all you have are actions, which
controller will these actions execute in? And what if you have two
controllers with the same name, how will rails disambiguate between
the two actions. Or say you wanted to get rid of the action name and
just have a controller name? Then what action should be called?

If you want to use the format:

myapp.com/products (shows index page)
应用宝官网-全网最新最热手机应用游戏下载 (shows details for product with id 1)
myapp.com/products/1/edit (shows edit screen for product with id 1)

then look into using restful routes.

Mike

Jason C. wrote:

Hello,

Is there a way to get Rails to ignore a leading-directory in a URL
(either in the environment.rb or routes.rb file)?

Any suggestions? Thank you!

-Jason

in your config/routes.rb

map.connect ‘blah/:controller/:action/:id’

hth

ilan