Characters Allowed in URLs
Salesforce B2C Commerce enables you to encode most characters used in URLs. B2C Commerce automatically encodes special or reserved characters, or umlauts in URLs, but doesn't remove them.
If you use product or category names to construct your URLs, you can configure whether spaces in names are encoded with '%20' or replaced by another character, such as a hyphen. You can also configure whether all characters should be converted into lower case and all URLs have a trailing slash. The characters allowed or disallowed in URLs applies to all B2C Commerce URLs, whether you are using the standard syntax, the search-friendly URL syntax, or the URL Rules URL syntax.
B2C Commerce URL Encoding of Product or Content IDs
Character | Description |
---|---|
- | Minus |
. | Period |
, | Comma - The comma can generally be used, except for the
Product-ShowInCategory pipeline that requires two parameters, in
which case category ID must not contain a comma. Note: Salesforce recommends not using commas in object IDs
to avoid possible problems with custom pipelines that require
multiple parameters.
|
_ | Underscore |
# | Number sign |
< | Less than |
> | More than |
% | Percent |
$ | Dollar Sign |
: | Colon |
; | Semicolon |
= | Equal sign |
While it's possible to use other characters in product IDs, Commerce Cloud generally recommends using alphanumeric characters in product and content IDs, because they can cause URLS to not be generated correctly.
B2C Commerce URL Encoding of Marketing Text
Characters Disallowed in SEO URLs:
-
&
- ampersand - ASCII control characters (ASCII code: 0x00-0x1F, 0xF7). For example, NULL, tab, or other invisible control characters are not allowed in SEO URLs.
Character Encoding Rules
B2C Commerce supports UTF-8 and ISO-8859-1 encodings. All other encodings supported by Java virtual machines are expected to work, but are not officially supported. See URL Syntax for information on specifying ISO or other encodings as part of a URL.
- All visible special ASCII characters except disallowed characters. If a disallowed character is present, it's replaced by a space replacement character ('+' or %20).
- Spaces at the beginning and the end of the marketing text are removed and multiple spaces compressed into one.
- Standard UTF8 URL encoding is applied, using a space substitute (%20, +) that you configure.
- Forward slashes (
/
) are not encoded and stay in clear text in generated URLs. - The plus sign (
+
) is encoded according to the current system configuration for the space substitution character.
These examples assume that the URLs use the default configuration and you can assume all encoded URLs are prefixed by the protocol and host name.
${name}/${productID}
Name | ID | Encoded URL |
---|---|---|
PRODUCTΓ€NAME | ID+ID | PRODUCT%C3%A4NAME/ID%20ID |
PRODUCT NAME | ID&ID | PRODUCT%20NAME/ID%20ID |
PRODUCT&NAME | ID?ID | PRODUCT%20NAME/ID%3FID |
PRODUCT+NAME | ID ID | PRODUCT%20NAME/ID%20ID |
PRODUCT%NAME | ID/ID | PRODUCT%25NAME/ID/ID |
PRODUCT/NAME | ID%ID | PRODUCT/NAME/ID%25ID |
PRODUCT-NAME | ID-ID | PRODUCT-NAME/ID-ID |