Change the Default Domain for %asset_url%?


#1

Hi Guys,

Is there a way to change the default %asset_url% root?

Context:
My website has multiple usable root domains;
Each asset has multiple URLs according to the domains. E.g.

Asset URLs:
www.example1.com/asset-name
www.example2.com/asset-name

Example1 is always chosen as the default replacement for assets. It appears to be the first one alphabetically, although this may not be why it is chosen.

Is there a way to change the default URL that is being chosen? I would like ‘www.example2.com/asset-name’ to be used when I utilise %asset_url%.

Or is there a way to get the specific URL that I’m looking for?
E.g. using %asset_urls% with a keyword modifier to filter for the prefix I’m looking for?


(John gill) #2

I think …

usually the domain is chosen based on the context that the keyword is being replaced in - so if %asset_url% is evaluated during a request to a URL starting example2.com then it will pick the example2.com URL.

An issue occurs when keywords are evaluated in a context that doesn’t have a URL associated with it - things like workflow emails, cron jobs, and some trigger executions. In that case, it just picks the first domain in the config.

This fix is to change the order of the domains in the System Root URLs config

If you set the one you want to be first, it should start getting picked for “keyword evaluations in a URL-less context”.