---
title: "Config Using Route Rules"
description: "Learn how to configure robots through route rules."
canonical_url: "https://nuxtseo.com/docs/robots/guides/route-rules"
---

> Index of every page on this site: [llms.txt](https://nuxtseo.com/llms.txt)

If you prefer, you can use route rules to configure how your routes are indexed by search engines.

You can provide the following rules:

- `{ robots: false }`{lang="json"} - Will disable the route from being indexed using the [robotsDisabledValue](https://nuxtseo.com/docs/robots/api/config#robotsdisabledvalue) config.
- `{ robots: '<rule>' }`{lang="json"} - Will add the provided string as the robots rule
- `{ robots: { /* directives */ } }`{lang="json"} - Will use object syntax to define robot directives

The rules are applied using the following logic:

- `X-Robots-Tag` header - All modes. The module copies the header into route rule `headers`. Static hosts then send it on static files.
- `<meta name="robots">`{lang="html"}
- `/robots.txt` disallow entry - When [disallowNonIndexableRoutes](https://nuxtseo.com/docs/robots/api/config#disallownonindexableroutes) is enabled

A more specific rule wins. With a default-deny setup, the allowed routes get an `X-Robots-Tag` header with the [robotsEnabledValue](https://nuxtseo.com/docs/robots/api/config#robotsenabledvalue) config.
Prerendered pages and sitemaps resolve route rules per URL, so the explicit allow beats the catch-all.

Static hosts send every matching `_headers` rule.
A noindex rule that also covers an allowed route would send noindex to that route.
The module drops such a rule from the output.
The denied pages keep the `<meta name="robots">` tag, and `robots.txt` crawling rules still apply.

## Inline Route Rules

Requires enabling the experimental `inlineRouteRules`, see the [defineRouteRules](https://nuxt.com/docs/api/utils/define-route-rules) documentation
to learn more.

```vue
<script lang="ts" setup>
defineRouteRules({
  robots: false,
})
</script>
```

## Nuxt Config

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  routeRules: {
    // use the `index` shortcut for simple rules
    '/secret/**': { robots: false },
    // add exceptions for individual routes
    '/secret/visible': { robots: true },
    // use the `robots` rule if you need finer control
    '/custom-robots': { robots: 'index, follow' },
    // use object syntax for more complex rules
    '/ai-protected': {
      robots: {
        index: true,
        noai: true,
        noimageai: true
      }
    },
    // control search result previews
    '/limited-preview': {
      robots: {
        'index': true,
        'max-image-preview': 'standard',
        'max-snippet': 100,
        'max-video-preview': 15
      }
    }
  }
})
```

## Sitemap

See the full [sitemap](https://nuxtseo.com/sitemap.md) for all pages.
