--- updatedAt: 2026-09-27 priority: 5 createdAt: 2025-08-23 title: "useRewriteURL Hook Documentation | react-intlayer" description: "Use useRewriteURL in React to rewrite the browser URL to its localized version, following the custom URL rewrites of your configuration." keywords: - useRewriteURL - react-intlayer - react - internationalization - i18n slugs: - doc - packages - react-intlayer - useRewriteURL author: aymericzip --- # useRewriteURL Hook The `useRewriteURL` hook is designed to manage localized URL rewrites on the client side. It automatically detects if the current URL should be corrected to a "pretty" localized version based on the user's locale and the rewrite rules defined in `intlayer.config.ts`. Unlike standard navigation, this hook uses `window.history.replaceState` to update the URL in the address bar without triggering a full page reload or a router navigation cycle. ## Usage Simply call the hook in a client-side component. ```tsx import { useRewriteURL } from "react-intlayer"; const MyComponent = () => { // Automatically correct /fr/tests to /fr/essais in the address bar if a rewrite rule exists useRewriteURL(); return