# Source: https://nuxt.com/raw/docs/3.x/api/utils/define-route-rules.md

# Source: https://nuxt.com/raw/docs/4.x/api/utils/define-route-rules.md

# defineRouteRules

> Define route rules for hybrid rendering at the page level.

<read-more icon="i-lucide-star" to="/docs/4.x/guide/going-further/experimental-features#inlinerouterules">

This feature is experimental and in order to use it you must enable the `experimental.inlineRouteRules` option in your `nuxt.config`.

</read-more>

## Usage

```vue [app/pages/index.vue]
<script setup lang="ts">
defineRouteRules({
  prerender: true,
})
</script>

<template>
  <h1>Hello world!</h1>
</template>
```

Will be translated to:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  routeRules: {
    '/': { prerender: true },
  },
})
```

<note>

When running [`nuxt build`](/docs/4.x/api/commands/build), the home page will be pre-rendered in `.output/public/index.html` and statically served.

</note>

## Notes

- A rule defined in `~/pages/foo/bar.vue` will be applied to `/foo/bar` requests.
- A rule in `~/pages/foo/[id].vue` will be applied to `/foo/**` requests.

For more control, such as if you are using a custom `path` or `alias` set in the page's [`definePageMeta`](/docs/4.x/api/utils/define-page-meta), you should set `routeRules` directly within your `nuxt.config`.

<read-more icon="i-lucide-medal" to="/docs/4.x/guide/concepts/rendering#hybrid-rendering">

Read more about the `routeRules`.

</read-more>