Announcements
Performance Best Practices
Monitor the Performance of Storefront Next
SEO URL Rules Best Practices for Storefront Next
Track Storefront Next Activity with Analytics
CLI Reference
B2C Commerce Release Notes
Ask the Community
Properly configured URL rules improve search engine optimization, user experience, and routing performance. Deterministic URLs ensure that a browser can determine the content type (product, category, or content) and how to fetch that content by examining the URL. Deterministic URLs enable faster client-side routing decisions, reduced API calls to resolve URLs, better SEO through predictable URL patterns, and improved performance by avoiding getUrlMapping API calls. This guide outlines best practices for configuring SEO URL rules in Storefront Next and Business Manager.
These best practices suggest some ways to configure SEO URL rules. Other SEO URL configurations can work depending on your needs. These suggestions are subject to change.
Note
Storefront Next uses React Router’s file-based routing that’s based on file and folder structure in Storefront Next. See File Route Conventions in the React documentation. The URL path of a request maps to a file name in the src/routes/ folder. For example, a request URL of https://www.example.com/product/{productId} maps to the _app.product.$productId.tsx file.
Another approach is to configure URL rules in Business Manager, and then make Storefront Next routing match those rules. Business Manager enforces certain URL requirements and serves as the canonical configuration for your B2C Commerce instance. Aligning Storefront Next with Business Manager ensures consistency across your commerce ecosystem.
Define URL structure in Business Manager. See Configure SEO URLs for B2C Commerce in Salesforce Help.
Configure Storefront Next routes, which are based on React Router’s file-based routing, to match the URL structure.
a. Update existing routes in src/routes/ to match the URL structure defined in Business Manager. For example, for the product detail page of \_app.product.\$productId.tsx, modify the file name to \_app.p.$productId[.html].tsx to match the URL structure outlined in URL Guidance for Products.
b. For new routes, create their corresponding file in src/routes/ and match the file name to the URL structure.
c. Implement logic in the route loader to extract IDs and slugs and fetch data.
Test URLs in both environments to verify consistency.
When you configure URL rules for products, we recommend that the URL includes:
/p/..html extension to match Business Manager requirements.1/p/product-id-12345.html
2/p/summer-dress.htmlWhen you configure URL rules for categories, we recommend that the URL:
/c/1/c/furniture-brand/outdoor-furniture
2/c/jewelry/category-id-567If category IDs aren’t in the URL, Storefront Next must call the getUrlMapping API to resolve the category. The API call adds latency but provides cleaner, more readable URLs.
Note
When you configure URL rules for categories, we recommend that the URL includes:
/content/..html extension to match Business Manager requirements.1/content/about-us.html
2/content/shipping-policy.html
3/content/content-id-789.html