When we move a page to another destination in AEM, it automatically updates all the links where that path is configured, as part of AEM's OOTB functionality. However my requirement is , if the links contain query parameters, they are not updated when the page is moved. Do you have any solution for this?
links : /content/site/us/en/home?q=abcd.
If I move home page, in this case it doesn't modify the link path because of query params, instead this if there is normal url (without params) it will change the url with destined path in the link field.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @KritikaGu ,
By default, AEM's page move action updates all the references to the moved page, including links in other pages, components, and assets. However, as you mentioned, if the links contain query parameters, they are not updated by the move action.
To update links with query parameters when a page is moved, you can use AEM's Link Rewriting feature. Link Rewriting allows you to modify links in AEM pages and assets based on specific rules and patterns.
Here are the general steps to update links with query parameters when a page is moved:
1. Define a Link Rewriting rule: Create a Link Rewriting rule that matches links with query parameters and updates the path based on the new location of the moved page. The rule should be specific to your use case and should only modify links that need to be updated.
2. Apply the rule to the appropriate pages: Apply the Link Rewriting rule to the pages that contain links with query parameters that need to be updated. You can apply the rule to individual pages or to a group of pages using a template or a tag.
3. Test the updated links: Test the updated links to ensure that they are working as expected and that the query parameters are preserved.
Here's an example of a Link Rewriting rule that updates links with query parameters when a page is moved:
```
<filter root="/content" mode="both" />
<rule>
<conditions>
<condition type="url" pattern="^/content/site/.*/home\?.*" />
</conditions>
<action type="rewrite" pattern="/content/new-site/$1" />
</rule>
```
This rule matches links that start with `/content/site/` and contain the string `home` followed by a question mark and any number of characters. The rule then replaces the `/content/site/` part of the link with `/content/new-site/`, which is the new location of the moved page.
Note that this is just an example and you should modify the rule to match your specific use case.
It's also recommended to test the Link Rewriting rule thoroughly and to consult with experienced AEM developers or solution architects to ensure that the rule is implemented correctly and does not cause any unexpected behavior.
Views
Replies
Total Likes
OOTB there is no feature like this. But you can try the below ACS AEM commons
https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/index.html
Hi @KritikaGu ,
By default, AEM's page move action updates all the references to the moved page, including links in other pages, components, and assets. However, as you mentioned, if the links contain query parameters, they are not updated by the move action.
To update links with query parameters when a page is moved, you can use AEM's Link Rewriting feature. Link Rewriting allows you to modify links in AEM pages and assets based on specific rules and patterns.
Here are the general steps to update links with query parameters when a page is moved:
1. Define a Link Rewriting rule: Create a Link Rewriting rule that matches links with query parameters and updates the path based on the new location of the moved page. The rule should be specific to your use case and should only modify links that need to be updated.
2. Apply the rule to the appropriate pages: Apply the Link Rewriting rule to the pages that contain links with query parameters that need to be updated. You can apply the rule to individual pages or to a group of pages using a template or a tag.
3. Test the updated links: Test the updated links to ensure that they are working as expected and that the query parameters are preserved.
Here's an example of a Link Rewriting rule that updates links with query parameters when a page is moved:
```
<filter root="/content" mode="both" />
<rule>
<conditions>
<condition type="url" pattern="^/content/site/.*/home\?.*" />
</conditions>
<action type="rewrite" pattern="/content/new-site/$1" />
</rule>
```
This rule matches links that start with `/content/site/` and contain the string `home` followed by a question mark and any number of characters. The rule then replaces the `/content/site/` part of the link with `/content/new-site/`, which is the new location of the moved page.
Note that this is just an example and you should modify the rule to match your specific use case.
It's also recommended to test the Link Rewriting rule thoroughly and to consult with experienced AEM developers or solution architects to ensure that the rule is implemented correctly and does not cause any unexpected behavior.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies