Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

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

Avatar

Level 3

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

8 Replies

Avatar

Level 2

Please tell us which Adobe software you are using so this question can be moved to a more appropriate forum. 

Avatar

Level 2

He said AEM. A moderator has moved this post to the Adobe Experience Manager forum.

Avatar

Level 3

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.

Avatar

Level 10

how are you planning on getting ID? This is not a documented use case. Let’s see if other community  members have input

Avatar

Level 3

We are getting that I.D from campaign and our authors wants to author it at page properties along with the vanity URL.

Avatar

Level 10

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.

Avatar

Level 3

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

Avatar

Correct answer by
Level 10

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.