Forum: Ruby on Rails Altering the starting URL for webrick

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Daniel B. (Guest)
on 2006-02-07 20:41
(Received via mailing list)
Hi all,

With webrick (i.e. "ruby script/server") is there a way to alter the
URL?  In other words, instead of "", I'd like it to
start at

And, still be on port 3000?

If it's not possible, that's fine.  Just thought I'd ask.


David R. (Guest)
on 2006-02-08 00:47
(Received via mailing list)
Hi, Dan.

Is this what you're after: you browse to, and you
automatically get routed to If so, then
yes, it's possible using the Rails routing system.

You should have a file named config/routes.rb in your project. Edit
that file and look for a line that has:

map.connect '' (note: those are two single-quotes with nothing
between them; it's easy to mistake them for one double-quote)

In the default routes.rb, this line is commented out, with a comment
above it that talks about routing the root of your site. Uncomment
that line if necessary, and edit it to look like:

map.connect '', :controller => "myapp" (again, that's two single-quotes)

This say to Rails, "if a request comes in for the root of the site,
use as the result". Rails will still prefer
serving the file public/index.html if it exists, no matter what route
you have defined for the site root. Remove (or rename) public/
index.html and you should be good to go.

Hope this helps.

This topic is locked and can not be replied to.