Expand my Community achievements bar.

SOLVED

Vanity redirects using query parameters in the AEM page properites

Avatar

Level 4

Hi All,

 

vanity in page properties works fine i.e https://www.test.com/abc redirects to https://www.test.com/en/samplepage.html

 

sonuk85184451_0-1697487969452.png

but to make it redirect to with using query parameter , do we have any custom solution to manage from page properties

 

how we can append parameter fname=aa&lname=bb from page properties itself to make author driven 

 

i.e https://www.test.com/abc should redirect to https://www.test.com/en/samplepage.html?fname=aa&lname=bb or https://www.test.com/en/samplepage?fname=aa&lname=bb

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@sonuk85184451 

 

'sling:vanityPath' do not support query params. You can go with below workarounds in this case.

  1. Set the rule in dispatcher directly.
  2. Use ACS common redirect manager and respect 'preserveQueryString' param in the configurations.
    https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/subpages/advan...
    Using this, you can set a path as source in ACS commons redirect manager configs and target path can contain query params. 'or' if you want to pass queryparams from source to destination URL, it can be done as well.

 

Hope it helps!!

 

View solution in original post

3 Replies

Avatar

Community Advisor

Yeah, I think the 'sling:vanityPath' does not support query parameters. That's why you are not seeing those queryParams being appended.

Depending on your requirements, I think you could consider some of these approaches:

Hope this helps



Esteban Bustamante

Avatar

Level 4

@EstebanBustamante  - i found an article to use ACS common feature Redirect Manager

is this will be good option ? it says its cloud compatible

https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/index.html

Avatar

Correct answer by
Community Advisor

@sonuk85184451 

 

'sling:vanityPath' do not support query params. You can go with below workarounds in this case.

  1. Set the rule in dispatcher directly.
  2. Use ACS common redirect manager and respect 'preserveQueryString' param in the configurations.
    https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/subpages/advan...
    Using this, you can set a path as source in ACS commons redirect manager configs and target path can contain query params. 'or' if you want to pass queryparams from source to destination URL, it can be done as well.

 

Hope it helps!!