---
title: "Routing, localization, and multi-sites"
slug: "routing-localization-and-multi-sites"
abstract: "Overview of resolving the current site, locale, and redirect rules for a request in a framework-agnostic app."
---
# Routing, localization, and multi-sites

After you [render](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/content-rendering.html "Content rendering") SitecoreAI content and [enable visual editing](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/visual-editing.html "Visual editing"), most solutions also need to resolve three things for every incoming request, before your app can make its `layout` query:

1. *Which site* is being requested - every layout, item, or search query requires a site name argument, in both single-site and multi-site environments.
2. *Which language* to request the content in.
3. Whether the requested path is a *redirect* that a content author configured, rather than a page.

These are three separate, independent capabilities. Sitecore doesn't bundle them together. However, all three run on every request, early in your request pipeline, before you fetch layout data. That's why frameworks such as Next.js typically implement them together as a chain of middleware. Your framework may not have an equivalent middleware concept. The important part is running this resolution logic early, for every page request, and passing the results (site name, language, and any redirect decision) into your layout query and routing logic.

## Get started

To get started with routing, localization, and multi-sites:

- [Learn about multi-site resolution](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/routing-localization-and-multi-sites/multisite-resolution.html "Multi-site resolution"), including how to retrieve your site list and match an incoming request to the correct site.
- [Learn about locale resolution](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/routing-localization-and-multi-sites/locale-resolution.html "Locale resolution"), including how language is passed to Sitecore queries, how language fallback works, and how to query the site dictionary and enumerate pages for static generation. See [Add a language to your environment](https://doc.sitecore.com/sai/en/developers/sitecoreai/content-modeling-and-presentation/working-with-languages/add-a-language-to-your-environment.html) to make additional languages available before resolving them in your app.
- [Learn about redirects](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/routing-localization-and-multi-sites/redirects.html "Redirects"), including how content-managed redirect rules are structured and matched.
- Complete the [Implement routing, localization, and multi-sites](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/routing-localization-and-multi-sites/implement-routing-localization-and-multi-sites.html "Implement routing, localization, and multi-sites") walkthrough, where you add site, locale, and redirect resolution to the app you built in the previous walkthroughs.
- Review the [troubleshooting](https://doc.sitecore.com/sai/en/developers/sitecoreai/introduction-to-framework-agnostic-sitecore-development/routing-localization-and-multi-sites/troubleshoot-routing-localization-and-multi-sites.html "Troubleshooting") topic for common issues.
