Skip to main content

SEO-friendly URLs in X-Cart 5.5.1.x

Learn how X-Cart 5.5.1.x builds page URLs and which URL settings you can change.

A
Written by Anna Verbichenko

This article applies to X-Cart 5.5.1.x. If your store runs X-Cart 5.6.x, see SEO-friendly URLs in X-Cart 5.6.x.

Clean URLs are always on in X-Cart 5.5.1.x — there’s no switch to enable or disable them. The address of every page is built from its Clean URL, the human-readable part you can edit in the Admin area. To learn how to edit it, see About SEO-friendly URLs in X-Cart.

URL structure

Page type

URL

Example

Product

/{clean-url}

Category

/{parent-category}/{category}/

Brand (Shop by Brand add-on)

/{clean-url}

Vehicle make and model (Make/Model/Year add-on)

/{make}, /{make}/{model}

Content page

/{clean-url}

Special storefront pages keep short fixed addresses, for example /contact-us/, /bestsellers/, and /all-brands/.

For the addresses of vehicle pages, see Vehicle page URLs (Make/Model/Year add-on).

URL settings

The URL settings are defined in the x_cart.clean_urls section of your store’s configuration (config/packages/x_cart.yaml). Changes to the URL formats don’t affect the addresses that already exist, and they require you to re-deploy your store to take effect.

Formats of product and category URLs

Setting

Default

Other values

product — format of product URLs

domain/goalproduct (/ams-front-mount-intercooler)

domain/goalproduct.html (adds .html)

category — format of category URLs

domain/parent/goalcategory/ (/cooling-systems/intercoolers/)

domain/goalcategory/ (no parent categories); domain/parent/goalcategory.html; domain/goalcategory.html

canonical_product — which address the rel="canonical" tag on a product page points to. It doesn’t change the address customers see when they open the product page

domain/product_clean_url — canonical points to the product’s own address, for example /ams-front-mount-intercooler

domain/main_category_clean_url/product_clean_url — canonical points to the product’s address with its category’s path in front, for example /cooling-systems/intercoolers/ams-front-mount-intercooler

Choose the formats before search engines index your store. If you change them later, you may need to set up 301 redirects from the old addresses.

Other settings

  • use_language_url (default: on) — adds the language code before the address of pages in languages other than your store’s default language, for example, /de/sale instead of /sale. Requires re-deploy.

  • default_separator (default: -) — the string that separates words in automatically generated clean URLs. Only a hyphen (-) and an underscore (_) are supported; an empty value means hyphens.

  • capitalize_words (default: off) — starts every word of a generated clean URL with a capital letter.

  • use_unicode (default: off) — allows non-Latin characters in generated clean URLs.

  • aliases — custom addresses for special pages, in the form target: 'clean-url'. By default, the address of the contact page is /contact-us.

  • short_product_urls_in_lists (default: off) — added in X-Cart 5.5.1.56. Controls the address of a product link shown on a category page. Off (default): the link includes the category path, for example /cooling-systems/intercoolers/ams-front-mount-intercooler, even though the same product is also reachable at the short address /ams-front-mount-intercooler. On: category pages link to the short address only.

Changes to default_separator, capitalize_words, and use_unicode don’t affect clean URLs that already exist.

Changing the category URL format

Be careful when you switch from a category format that includes parent categories to one that doesn’t. If categories with the same name exist at different levels, they can end up with the same address, and some category pages become unreachable.

Example. The category format is domain/parent/goalcategory/, and you have three categories named “Oils”: at the top level (example.com/oils/), in “Supplements” (example.com/supplements/oils/), and in “Beauty” (example.com/beauty/oils/). If you switch to domain/goalcategory/, all three get the address example.com/oils/, and only one of them stays reachable.

FAQ

Q: Can I remove the parent categories from category URLs?

A: Yes. Set the category format to domain/goalcategory/. Make sure that your categories have unique names, or set different clean URLs for them manually.

Q: Can I get URLs that end in .html?

A: Yes. Use the product and category formats that end in .html.


Can't find answers you're looking for?

Email us at support@x-cart.com. We will be happy to help!


Did this answer your question?