無法將​ shipping ​儲存為URL索引鍵

本文提供當您無法將shipping儲存為產品或CMS頁面的URL索引鍵(例如, /shipping)時,此問題的因應措施。 當您嘗試儲存URL金鑰時,您會收到一個錯誤,指出URL金鑰是重複的URL。

受影響的產品和版本

Adobe Commerce (所有部署方法) 2.4.x

問題

您無法在URL索引鍵中儲存字詞為​ shipping ​的CMS頁面。

要再現的步驟

以URL金鑰建立​ 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 ​個字元,字詞可以是任何字串。

執行下列步驟:

  1. 登入Adobe Commerce管理員。

  2. 前往​ Marketing > SEO & Search > URL Rewrites

  3. 按一下​ Add URL Rewrite

  4. 在​ Create URL Rewrite ​下拉式清單中選取​ Custom

    1. 輸入Request Path作為​ 送貨

    2. 在​ Target Path ​中,輸入新的URL索引鍵(例如,"shipping1")。

    3. 在​ Redirect ​下拉式清單中選取​ No

      注意:請求路徑是使用者在瀏覽器中輸入的內容,而目標路徑是它應該重新導向到的位置。)

此外,請避免使用這些標示為​ reserved ​關鍵字的關鍵字,造成出現相同的例外狀況。 使用下列任一關鍵字做為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"

相關閱讀

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a