Cannot save “shipping” as URL key
This article provides a workaround for the issue when you are not able to save “shipping” as a URL key (e.g., “/shipping”) for products or CMS pages. When you try to save the URL key, you receive an error that indicates that the URL key is a duplicate URL.
Affected products and versions
Adobe Commerce (all deployment methods) 2.4.x
Issue
You cannot save a CMS page with the term “shipping” in the URL key.
Steps to reproduce:
Create a CMS page with URL key as “shipping”.
Expected result:
The page saves with “shipping” in the URL key.
Actual result:
You cannot save and an error appears: The value specified in the URL Key field would generate a URL that already exists.
Cause
Shipping is a reserved word defined in vendor/magento/module-shipping/etc/frontend/routes.xml
.
<router id="standard">
<route id="shipping" frontName="shipping">
<module name="Magento_Shipping" />
</route>
</router>
Solution
You cannot use the term “shipping” in your URL key - however you can use the term “shipping” combined with another letter or number (For example, “shipping1” and “shipping2”). Although the term does not have to be “shipping”+<another number or letter> - the term could be any string as long as the length does not exceed 255 characters.
Perform the following steps:
-
Log in to the Commerce Admin.
-
Go to Marketing > SEO & Search > URL Rewrites.
-
Click Add URL Rewrite.
-
Select Custom on the Create URL Rewrite drop down.
- Type in the Request Path “shipping”. Note: The Request Path is what a user enters in the browser and the Target Path is where it should redirect to.
- Type in the Target Path the new URL key (For example, “shipping1”).
- Select No in the Redirect drop down.
Related reading
- URL Rewrites in our user guide.
- SEO Best Practices in our user guide.