function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Create a redirect mechanism on an entire site with a regex (workaround for missing smart links)

Hello, I am trying to solve the issue of Smart Links not supported in the Community Template.
The best workaround I found is to create a redirect rule at the Site level that does something very simple:

- if a web visitor requires to access:
- the visitor is instead redirected (permanent redirection) to:

I cannot afford doing this manually (creating one redirect rule) for each article/page.

Basically I'll need something as simple as an expression that replaces:*

Which is the simplest way to do it? Is it some sort of redirect regex rule? Or there is a way using an APEX class that does some redirection based on parameters (e.g. the article number and the language code)?

Thanks for any suggestion.
Everything that I'm reading seems to show that you cannot use wildcards in the redirect.  If you have less than 1000 total redirects, you could do it programatically and just push the redirects to the metadataAPI [1] (under siteRedirectMappings).  I know it's not as automatic as you want but it might get you there.

Hello Pcon,

thank you for helping. If I could use wildcards that would be fantastic, but it seemed to me that wildcards are not supported. Is that correct? If they are supported, can you point me to an article/tutorial?

The option of using metadata API might also work. Is there a way to call metadata APIs from an apex trigger/class? Again, if you can point me to any article/tutorial, that would help a lot.


we found a solution to have SmartLinks working in Community Templates.