Redirects
Learn how to manage scalable redirects
SEO redirects play a crucial role in maintaining website health and search engine optimization. They ensure that users and search engines are directed to the correct URLs, preventing issues like broken links and duplicate content. Enterprise Commerce offers a robust and scalable SEO redirect solution capable of handling thousands of redirects with ease.
This solution utilizes Bloom filters, a probabilistic data structure, to optimize data lookup performance. As described in the Next.js documentation, Bloom filters efficiently determine whether a specific URL requires redirection without the need to iterate through the entire list of redirects. This significantly improves performance and ensures fast response times even with a large number of redirects in place.
By implementing SEO redirects you:
- Maintain SEO value: Redirect outdated or deleted pages to relevant content, preventing loss of search engine ranking and traffic.
- Improve user experience: Ensure users land on the correct page, avoiding frustration and confusion.
- Boost website performance: Efficiently handle redirects without compromising website speed.
With its scalable and optimized approach, Enterprise Commerce provides a reliable solution for managing SEO redirects and ensuring optimal website performance.
Configuration
We store redirect rules in a JSON file located at apps/web/redirects/redirects.json
.
This file follows a simple structure, where each key represents the old URL path, and the corresponding value is an object containing the destination
URL and a permanent
flag indicating whether the redirect is permanent (301) or temporary (307).
Here’s an example of the redirects.json
file:
To modify existing redirects or add new ones, simply edit the redirects.json
file according to your needs. Remember to maintain the correct JSON structure.
Important: After making changes to the redirects.json
file, you must execute the following command to update the generated Bloom filters:
This command ensures that the redirect system remains optimized for performance. Once the Bloom filters are updated, commit your changes and redeploy the application for the new redirects to take effect.