Vanity URL's need to redirect to actual URL with I.D appended to it.

adithyaa6344757

29-03-2019

I'm working in AEM 6.3. I'm trying to extend the default behavior of vanity URLs such that the following will happen:

So I'd be extending the default page properties vanity functionality to include an authorable ID field to it.

1) User navigates to vanity URL and is redirected to actual URL

2) ID that is associated (and authorable) is appended to the URL

Example:

Vanity URL: /foobar

ID: 123(authored)

Actual URL: www.test.com/plans

Now when I hit the vanity url it should redirect to:

Resulting URL: www.test.com/plans?123

I've been able to modify the page properties to include a new field associated with the vanity URL in the UI. It doesn't appear to be saving the actual value though.

I can add a completely new multifield with both Vanity and I.D fileds in it but how to make this work and how to append the authored I.D to the URL is what i trying to figure out.

Accepted Solutions (1)

Accepted Solutions (1)

Gaurav-Behl

MVP

29-03-2019

I'm not sure of your design when you say then you plan to use sling:vanityPath via page properties. Using this approach you can configure a vanity on a target page url. You'd still need to find a solution for appending your query string which can be done using additional redirect or post-processors. per your use case of one-to-one or  one-to-many relationship.

You could still create sling mappings per vanity per page via /crx/de.

You may customize the implementation of Vanity Path Rewrite Mapper or Redirect Map Manager  to achieve your use case

Another solution would be to create a redirect rules file in AEM via code, push it to apache via job and let mod_rewrite pick it and use it dynamically. Think through all pros/cons for this solution based on your setup.

The above solutions assume that your requirement is not related to analytics tracking as I mentioned above.

Answers (7)

Answers (7)

adithyaa6344757

29-03-2019

gauravb10066713

How many vanities would you have?:

ANS: Every page will have a vanity url and that url should append the authored I.D at the end of actual URL.

How many params/Ids would you have?

I just need to have one that is I.D.

What is the relationship between vanity vs IDs vs target urls?

Those I.D's are campaign I.D's that needs to be present at the end of the URL.

Example:

when you hit /businessicon it needs to redirect to

https://www.company.com/business/all-products-and-services.html/?sid=AlM_2018Aug_DRscrollsheet

Currently we are giving this kind of rules in vanityurl.conf file and general redirects without I.D we are giving at vanity URL field in page properties.

Now we want to author vanity and I.D both at the page properties and it should provide us the same functionality as vanity url.conf file.

Example of vanity rule:

/businessicon--> https://www.company.com/business/all-products-and-services.html/?@sid=AIM_2018Aug

Gaurav-Behl

MVP

29-03-2019

There are multiple solutions to achieve this. It depends on your requirements  e.g: 

How many vanities would you have?

How many params/Ids would you have?

What is the relationship between vanity vs IDs vs target urls?

I'm not sure if you are trying to marry this server-side solution with utm params or adwords campaigns or analytics use case?

The easiest non-authorable solution is to use "sling mappings". If you want to include author functionality then you could use either sling mappings or page properties/sling:vanityPath or apache redirects or custom json with key/value pairs and perform your use case.

adithyaa6344757

29-03-2019

Every vanity should also have an  I.D authored to it in page properties and this I.D needs to be appended to actual URL when we hit the vanity URL.

Can anyone help me on this please.