Altering the starting URL for webrick


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.




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.