Skip to content
Log in

Rename storefront URL paths

On this page

The fixed words in your storefront URLs, such as /cart, /checkout, /products and /account, can be renamed for each store. A store that sets route.cart to basket serves the cart at /basket, and every link, redirect, canonical tag, sitemap entry and email link the platform writes uses /basket too. Use this to localize your URLs, match your brand, or keep the URL structure of a site you are migrating from.

Renames apply to one store only. A store with no route. variables keeps the built-in words.

What you can and cannot rename

You can rename any of the 44 segments in the table below. Renaming a segment renames it everywhere it appears in a storefront path, including every path beneath it. For example, setting route.account to my-account moves /account/orders to /my-account/orders.

These cannot be renamed:

  • auth, which holds sign-in and single sign-on URLs. Your identity provider stores those URLs, so they must stay fixed.
  • POS and API paths.
  • Values that belong to a record, such as a product slug, a category path, or an order reference number. Product category pages already sit at the top level, for example /four-seater, so they have no segment to rename.
  • The store path prefix, such as /eu, and the domain.
Key Built-in segment Example path
route.accept accept /auth/invitation/accept
route.accept_terms accept_terms /checkout/accept_terms
route.account account /account
route.account_credits account_credits /account/account_credits
route.account_points account_points /account/account_points
route.accounts accounts /accounts
route.activation activation /vouchers/<voucher>/activation
route.addresses addresses /account/addresses
route.articles articles /articles
route.bundles bundles /bundles/<id>/edit
route.cart cart /cart
route.carts carts /account/carts
route.categories categories /categories
route.check-voucher check-voucher /check-voucher
route.checkout checkout /checkout
route.confirm confirm /orders/<order-reference>/payment/confirm
route.confirmation confirmation /auth/confirmation
route.customer_information customer_information /checkout/customer_information
route.edit edit /account/addresses/<id>/edit
route.find find /find/<group>
route.fulfillments fulfillments /account/fulfillments
route.invitation invitation /auth/invitation
route.missing_details missing_details /account/missing_details
route.nested_configurator nested_configurator /bundles/<id>/nested_configurator
route.new new /account/addresses/new
route.order order /checkout/order
route.orders orders /account/orders
route.password password /auth/password
route.payment payment /account/subscriptions/<id>/payment
route.payment_gateway payment_gateway /checkout/payment_gateway
route.payment_information payment_information /checkout/payment_information
route.payment_methods payment_methods /account/payment_methods
route.pending pending /auth/confirmation/pending
route.product_approvals product_approvals /account/product_approvals
route.product_comparison product_comparison /product_comparison
route.products products /products
route.profile profile /account/profile
route.register register /accounts/register
route.search search /search
route.shipping_information shipping_information /checkout/shipping_information
route.sign_in sign_in /auth/sign_in
route.sign_out sign_out /auth/sign_out
route.subscriptions subscriptions /account/subscriptions
route.vouchers vouchers /vouchers/<voucher>/activation

The segments under /auth, such as sign_in and password, can be renamed even though auth itself cannot. Renaming sign_in to login gives /auth/login.

Choose a word

The new word must:

  • use only lowercase letters, digits, hyphens and underscores, and start and end with a letter or digit
  • not be a word the platform already uses in a storefront path that cannot be renamed, such as pos, api, sitemap, promotions or payments
  • not be the Path of another store on the same Salesforce org, or a POS path
  • not be used by another route. variable on the same store

A word that breaks one of these rules is ignored, and the built-in word stays in use. The web console shows a warning that names the variable and the reason.

You can reuse another built-in segment as the new word, for example setting route.products to categories. The rename wins, and the pages the reused word reached, such as the /categories listing, can no longer be reached unless you rename that segment too. The web console lists the pages that become unreachable.

A content page or a product category whose Path matches the new word cannot be reached while the rename is in place, and no warning is shown. Choose a word that no page or category uses.

Rename a segment

Before you start

  • Find any links you typed yourself that use the built-in word, such as a menu item URL of /products/merino-hiking-socks or a link in page content. The platform rewrites the links it generates but not the ones you type. They keep working while the original path is left at the default, 200.
  • If your theme replaces the built-in layout template (layouts/theme.liquid), confirm the replacement still contains {%- default route_segment_meta_tags: nil -%} at the top and {{ route_segment_meta_tags }} in the <head>. Without them, the storefront’s JavaScript keeps requesting the built-in paths.

Steps

  1. Open the Store record and go to the Store Variables related list.
  2. Click New.
  3. Enter a Name, for example Rename products path.
  4. Enter the Key for the segment, for example route.products.
  5. Enter the new word as the Value, for example shop.
  6. Save the record. Available in Liquid does not need to be checked.
  7. On the Store record, change the Cache Version field to any different value. This regenerates cached menus and page fragments, which otherwise keep the built-in word in their links until they expire.
  8. Open the web console and load a storefront page. Correct any variable that the console reports as rejected.

The change takes effect on the next page request. In this example, a product page that was at /products/merino-hiking-socks is now served at /shop/merino-hiking-socks, and product links across the storefront point to /shop/. The old /products/merino-hiking-socks address still loads the page until you change what the original path does.

Choose what the original path does

After a rename, the original built-in path keeps serving the page by default. To change that, add a second store variable for the same segment with the key route.<segment>.former, for example route.products.former.

Value What the original path does
200 (default) Keeps serving the page. Both the original and the renamed path work.
301 Permanently redirects to the renamed path.
404 Returns your store’s not-found page.

A .former variable has no effect unless the same segment is renamed. A value other than 200, 301 or 404 is ignored, and the original path keeps serving. Both cases show a warning in the web console.

Redirect the original path (301)

  • A page request redirects with a 301 status. A form post or other non-page request redirects with a 308 status, so the submitted data is sent again to the renamed path.
  • The query string is kept, and so is a format suffix: /cart.json redirects to /basket.json.
  • Capitalization is ignored, so /Cart also redirects.
  • Every path beneath the segment redirects too. route.account.former set to 301 redirects /account/orders to /my-account/orders.

Use 301 when you rename a segment on a live store. Search engines move their index to the renamed URLs, and bookmarks and old links keep working.

Retire the original path (404)

  • Page requests return your store’s themed not-found page with a 404 status.
  • Every path beneath the segment is retired too. Retiring checkout also retires /checkout/customer_information.
  • Form posts and other requests to the original path are refused with a 404, so nothing reaches the cart, checkout or account through it.
  • To serve something at a retired path, create a content page with that Path. It is shown instead of the not-found page.

:::warning Before you set 404, check every link and redirect that still uses the built-in word. A retired path breaks them:

  • Route mappings. The redirect StoreConnect creates when a product or article URL changes uses the built-in /products/ or /articles/ word, for example To /products/merino-hiking-socks. The To value is not rewritten, so with route.products.former set to 404 that redirect ends on the not-found page. Update the To field of affected route mappings to the renamed path, or use 301 instead.
  • Links you typed, such as menu item URLs and links in page content.
  • Custom theme code that builds a storefront path itself. See the next section. :::

Theme code that builds storefront paths

The built-in theme already uses your renamed words. Custom theme code needs a change only if it writes a storefront path itself, for example a hand-written fetch to /cart.

  • JavaScript. Pass the built-in path to window.StoreConnect.storePath, which returns it in the store’s words with the store path prefix added. On a store at /eu that renames cart to basket, window.StoreConnect.storePath("/cart") returns /eu/basket. Do not swap the words yourself: the helper knows which parts of a path are segments and leaves a product slug that happens to be cart alone.
  • Liquid. The path, fullpath, local_path and url attributes of current_request return the path in the store’s words. To compare against a built-in path, use current_request.platform_path, which returns the path in the built-in words, for example /cart while the shopper is on /basket. See the request object reference.

An untranslated path keeps working while the original path is left at 200, which hides the problem. It fails when you later set the original path to 404, and a non-page request can lose the submitted data across a 301. Fix custom code before you change the .former value.

Undo a rename

  1. Open the Store record and go to the Store Variables related list.
  2. Delete the route.<segment> variable and any matching route.<segment>.former variable.
  3. On the Store record, change the Cache Version field to any different value.

Links go back to the built-in word, and the built-in path serves the page again. The renamed path stops working, so if search engines or customers already use it, add a route mapping from the renamed path to the built-in one.

Was this article helpful?

Was this article helpful?