Resolve canonical URL mismatches with trailing slash rewriting in Adobe Edge Delivery Services
Adobe Edge Delivery Services may have canonical URL mismatches when trailing-slash redirects cause the user-facing URL to differ from the canonical URL generated for the underlying content path. To resolve the issue, configure CDN rewriting and redirects, define the preferred canonical URL in metadata, and keep sitemap entries consistent with the trailing-slash URL format.
Description description
Environment
- Adobe Edge Delivery Services
- Migration from platforms that use trailing slashes in URLs, such as WordPress
Issue/Symptoms
- Requests to unslashed paths, such as
/blog, resolve to content files such asblog.md. - Requests with a trailing slash, such as
/blog/, look forblog/index.mdand may return HTTP 404 when the file doesn’t exist. - CDN transformations used for rewriting and redirecting URLs may cause the user-facing trailing-slash URL to differ from the canonical URL generated by Edge Delivery Services.
- Search engines and social crawlers may not recognize the preferred canonical URL when it’s updated only client-side after page load.
Root cause
Inconsistent handling of trailing slashes during migration and URL rewriting can cause mismatches between user-facing URLs, canonical tags, and sitemap entries, affecting SEO and the browsing experience.
Resolution resolution
Follow the steps below to resolve the issue.
-
Implement CDN request transformations and redirects:
- Configure your CDN to rewrite requests for
/page/to/pageso that Edge Delivery Services can resolve the existing.mddocument. - Set up a 301 redirect from
/pageto/page/to enforce trailing-slash URLs for users and search engines.
- Configure your CDN to rewrite requests for
-
Override canonical URLs in Edge Delivery Services:
-
Option 1: Use a bulk metadata sheet (recommended for scale):
- Create a metadata sheet in your content source, such as
metadata.xlsxfor SharePoint or metadata for Google Drive. - Add columns for the page URL/path and a canonical column.
- For each page, set the canonical value to the preferred trailing-slash URL, for example,
https://www.example.com/blog/. - Publish the metadata sheet. Edge Delivery Services will emit the canonical tag in the HTML head as specified.
- Create a metadata sheet in your content source, such as
-
Option 2: Use a metadata block in the page markdown (for individual pages):
- In the page’s .md file, add or adjust the metadata block to include a canonical property:
canonical: https://www.example.com/blog/ - When published, Edge Delivery Services uses this value for the canonical tag in the HTML head.
- In the page’s .md file, add or adjust the metadata block to include a canonical property:
-
-
Ensure sitemap URLs use trailing slashes:
- Configure sitemap generation, for example, through
helix-sitemap.yamlor a custom sitemap file, so that<loc>entries use trailing slashes. - Ensure that
robots.txtand any SEO tooling reference the correct sitemap. - Keep canonical tags and sitemap entries consistent.
- Configure sitemap generation, for example, through
-
Verify the configuration:
- Check the HTML source of the published pages to confirm that the canonical tag uses the preferred trailing-slash URL.
- Review the sitemap to ensure that all entries use the same trailing-slash format.