Chapter 6: Salesforce Commerce Cloud Aliases

Discover the secret power of the Salesforce Commerce Cloud Alias file. Read more today!
June 2, 2022

A brief Blurb about Aliases


I won’t spend too much time in this section as I don’t have enough experience.

See Salesforce Commerce Cloud documentation for configuring an Alias file here

The Aliases, or hostname alias, are files that help denote the URL request, and to an extent, the URL structure of a specific environment.

Please note that you have to write an Alias file per environment – Staging, Development, and Production.

You’ll also have to set up and register the DNS and domain names, if you’d like to see something as clean as https://stg.example.com/, otherwise you might have to lean on Salesforce’s domain structure.

The Alias file can be extraordinarily helpful when trying to build an optimal domain structure. With an Alias file, you can

  • Build an international SFCC site and set up redirect behavior for each regional property
  • Use or drop www. in a domain and redirect, en masse, accordingly
  • Perform domain level redirects

Regarding the last bullet, I’ve used Aliases when migrating a website that consolidates multiple domains into a single domain. That is, the Alias acts as a directive on how to treat specific external domains when they enter the site. All in all, the Alias file has been a life saver for international migration projects.

The file requires the use of JSON to drive directives. See below for the basic format of an Alias file within SFCC.

"__version": "1", 
"settings": { 
     "http-host": "httphostname", 
     "https-host": "httpshostname",
     "job-hostnames":
      {
        "default":"www.my-default-host.com",
        "de":"www.my-de-host.com",
        "en":"www.my-en-host.com"
      }, 
     "site-path": "sitepath", 
     "default" : "defaultValue",
     "site-path-trailing-slash" : "yes", } 
"hostName1": [
   { mappingRule1 },
   { mappingRuleN }
 ],
"hostNameN": [
   { mappingRule1 },
   { mappingRuleN }
]
}

Please note, it can be a very powerful tool and can save you a ton of time in your optimizations but it can also lead to issues.

I had once decided to test what would happen if I delete an Alias file. I removed it from the SFCC staging site and the site had gone down. I backed up the file and then I reimported it and the site came back online.

With that, I strongly urge that when you need to touch the Alias file, open an SEO dev ticket and consult with development resources for support.

In certain areas of the site, particularly the sitemap, you need to have an Alias file to enable functionality.

When something is amiss on a SFCC site and someone asks me what the issue is, depending on the issue, one of the first things I’d check is Alias file.

Get in Touch


Subscribe To #PragmaticSEO

Practical SEO advice. Personal SEO advice.

[Active] Blog Post - Side Bar Newsletter Signup

Reach out

[Active] Blog Post - Side Bar Contact Form

☕ Buy me a coffee

I hope you’ve been enjoying these posts.

If so, please considering making a donation to my ☕ coffee fund ☕.

Donations will cover the cost of web maintenance & the coffee needed for brainstorming and implementing new ideas 🤔.