无法将 shipping 另存为URL键
当您无法为产品或CMS页面将shipping另存为URL密钥(例如, /shipping)时,本文提供了此问题的解决方法。 当您尝试保存URL键时,您会收到一个错误,指示URL键是重复的URL。
受影响的产品和版本
Adobe Commerce(所有部署方法) 2.4.x
问题
无法在URL键中保存术语为 shipping 的CMS页面。
重现步骤:
创建URL键为 shipping 的 CMS page。
预期的结果:
该页面将以 shipping 作为URL键进行保存。
实际结果:
发生此错误时,无法保存:
在URL键字段中指定的值将生成一个已存在的URL。
原因
送货是在vendor/magento/module-shipping/etc/frontend/routes.xml
中定义的保留字。
<router id="standard">
<route id="shipping" frontName="shipping">
<module name="Magento_Shipping" />
</route>
</router>
解决方案
无法在URL密钥中使用术语 shipping,但可以将术语 shipping 与另一个字母或数字(例如,shipping1和shipping2)结合使用。
尽管术语不必是 发货+<其他数字或字母> — 术语可以是任何字符串,只要长度不超过 255 个字符。
执行以下步骤:
-
登录到Adobe Commerce管理员。
-
转到 Marketing > SEO & Search > URL Rewrites。
-
单击 Add URL Rewrite。
-
在 Create URL Rewrite 下拉列表中选择 Custom。
-
键入Request Path为 shipping。
-
在 Target Path 中,键入新的URL密钥(例如,“shipping1”)。
-
在 Redirect 下拉列表中选择 No。
(注意:请求路径是用户在浏览器中输入的内容,目标路径是用户应重定向到的路径。)
-
此外,请避免使用这些标记为 保留 关键字的关键字,这会导致出现相同的异常。 使用下面列出的这些关键字中的任意关键字作为URL键值将导致出现相同的错误。
"admin"
"adminAnalytics"
"analytics"
"api"
"backup"
"bulk"
"captcha"
"catalog"
"catalogsearch"
"checkout"
"cms"
"contact"
"cookie"
"customer"
"directory"
"downloadable"
"giftmessage"
"groupedProduct"
"indexer"
"instantpurchase"
"loginascustomer"
"marketplace"
"mui"
"multishipping"
"newsletter"
"oauth"
"paypal"
"persistent"
"productalert"
"releaseNotification"
"reports"
"review"
"robots"
"rss"
"sales"
"search"
"security"
"sendfriend"
"shipping"
"stores"
"swagger"
"swatches"
"tax"
"theme"
"translation"
"vault"
"wishlist"