# How to Add a root Route in Rails

*Published on July 09, 2024*

Tags: Router

---


> This post is part of my&nbsp;[handbook on the Rails Router](/tag/router).

Your application's home page is one of the most important and highly trafficked page. This is the page many visitors will encounter the first time they visit your application.

The&nbsp;`root`&nbsp;helper method configures the home page of your Rails app.

```ruby
Rails.application.routes.draw do
  # Defines the root path route ("/")
  root "application#home"
end
```

The root indicates the application URL&nbsp;`'/'`, without any path, such as&nbsp;`/users`.

The router parses the routes top-down and stops search as soon as it finds a matching route. Hence, it's recommended that you should put the&nbsp;`root`&nbsp;route at the top of the routes file. It is the most popular route which should be matched first.

Since most visitors will be visiting the application by making a GET request to your application URL, the&nbsp;`root`&nbsp;route only handles and routes HTTP&nbsp;`GET`&nbsp;requests.

You can also use the root helper inside a namespaces and scope.

```ruby
namespace :admin do
  root to: "admin#index"
end

root to: "home#index"
```

If you don't provide the root route, Rails routes the request to the home page to an internal controller&nbsp;`Rails::WelcomeController`&nbsp;which renders the welcome page.

![home.webp](https://writesoftwarewell.com/media/nnr8m3a2n8gaq9mher9zljsrznbb.webp "Rails welcome page")

