> Markdown version of [Defining Routes](https://vaadin.com/docs/next/flow/routing/route). Section index: [llms.txt](https://vaadin.com/docs/next/flow/llms.txt)

# Defining Routes

You can use the `@Route` annotation to define any component as a route target for a given URL fragment.

For example, you can define the `HelloWorld` component as the default route target (i.e., empty route) for an application like this:

```java
@Route("")
public class HelloWorld extends Div {
    public HelloWorld() {
        setText("Hello world");
    }
}
```

**Example**: Defining the `SomePathComponent` component as the target for the specific route `"some/path"`.

```java
@Route("some/path")
public class SomePathComponent extends Div {
    public SomePathComponent() {
        setText("Hello @Route!");
    }
}
```

Assuming your application is running from the root context, when the user navigates to `https://example.com/some/path`, either by clicking a link in the application or entering the address in the address bar, the `SomePathComponent` component is shown on the page.

If you omit the `@Route` annotation parameter, the route target is derived from the class name. The derived name is in lower case and the trailing **View** is removed. Also, **MainView** or **Main** names are mapped to **root** (*value is* **""**).

For example:

- `MyEditor` becomes `"myeditor"`

- `PersonView` becomes `"person"`

- `MainView` becomes `""`

## <a id="creating-route-aliases"></a>Creating Route Aliases

You can also use `@RouteAlias` to create aliases for routes. A primary route created by `@Route` is required. It’s possible to create multiple aliases for a route.

**Example**: Adding two `@RouteAlias` annotations for `HomeView`. Navigating to `"home"` or `"main"` navigates to the same view as the main route.

```java
@Route("")
@RouteAlias("home")
@RouteAlias("main")
public class HomeView extends Div {
    public HomeView() {
        setText("Hello @Route!");
    }
}
```

> **Note:** All navigation target paths in the application, including the paths of React views, must be unique to allow the routing logic to determine the view to render without any disambiguation. This affects all `@Route` and `@RouteAlias` values combined with any possible `@RoutePrefix` value. When conflicts are detected, the application fails to start and logs a message stating the reason for the conflict.

`693776E5-D147-403A-A01D-04A3E9BF46AC`
