URL redirect | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Hi 

Please have a look at this community article:-

Link:- http://aem.matelli.org/url-mapping-and-deep-linking/

//

sling:Mapping Redirects: AEM’s most powerful URL-manipulation feature, a set of redirect components, is often overlooked because application servers don’t traditionally have this ability. But CQ’s built in Vanity URL support, namespace mangling, and internal tools all make use of this ability. A custom application can too, for instance, by remapping all /content project to /content/myproject

In CRX, navigate to the /etc/map node.
Open (or create) the http node of type sling:Folder
Create a node called content of type sling:Mapping
Add a property called sling:match and give it a value of localhost.4502/content/
Add a property called sling:internalRedirect and give it a value of /content/myproject

Now navigate to http://localhost:4502/content/mypage.html. The browser will display the URL that was entered, but internally AEM will be referencing the mapped directory structure.

 

Reference Link:- https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html#root-level-mappings

I hope this will help you.

Thanks and Regards

Kautuk Sahni

7 replies

kautuk_sahni
Community Manager
Community Manager
June 3, 2016

Hi 

Please have a look at this community article:-

Link:- http://aem.matelli.org/url-mapping-and-deep-linking/

// http://mycompany.com/content/myproject/home.html Convert to “http://mycompany.com/” 

options:- 

1. Root Mapping

2. Page Redirects

3. sling:Mapping Redirects

4.Dynamic Redirects

5. Deep Linking

 

Reference Link 2:- http://www.cqblueprints.com/tipsandtricks/serving-static-assets-alt-url.html

//

Defining Mappings
Mappings can be defined in two different places:

Using the Configuration Manager (ie. http://localhost:4502/system/console/configMgr) and changing the properties of the Apache Sling JCR Resource Resolver service.
Defining configuration nodes under the /etc/map node in the repository.
For the 2nd option, we can simply create additional nodes under the /etc/map node that define the mappings we need. In the image below we have created a folder called http of type sling:Folder and we created a node of type sling:Mapping called static.example.com

Next we set a property on the sling:Mapping node called sling:internalRedirect and gave it the value /content/dam

[img]http://www.cqblueprints.com/content/blueprints/en/tipsandtricks/serving-static-assets-alt-url/_jcr_content/main/image.img.png/1358966625497.png[/img]

 

I hope this will help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
kautuk_sahni
Community Manager
Community Manager
June 7, 2016

Hi 

Is your problem resolved ?

If you have devised a new solution, please share it here for communities benefit.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
amrit1993
amrit1993Author
Level 3
June 7, 2016

Hi,

No it is still not solved, I am thinking of adding the redirect rule in my conf file:

RewriteRule ^/$  / [R]
    RewriteRule ^/mywebsite/en$ /content/en/home.html [PT,L]

 

Will this work ?
       

Adobe Employee
June 7, 2016

Hi,

you can use /etc/map[0] to resolve and map incoming and outgoing URL's.

An alternative is to use JCR Resource resolver to map outgoing URL's and use Dispatcher to handle incoming Requests.

There is a very good article[1] which clearly explains all the above concepts that you should check out as well.

Regards,

Opkar

[0]https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html

[1]http://www.cognifide.com/our-blogs/cq/multidomain-cq-mappings-and-apache-configuration/

[2] https://docs.adobe.com/docs/en/dispatcher/disp-domains.html

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
June 8, 2016

Hi 

Please have a look at this community article:-

Link:- http://aem.matelli.org/url-mapping-and-deep-linking/

//

sling:Mapping Redirects: AEM’s most powerful URL-manipulation feature, a set of redirect components, is often overlooked because application servers don’t traditionally have this ability. But CQ’s built in Vanity URL support, namespace mangling, and internal tools all make use of this ability. A custom application can too, for instance, by remapping all /content project to /content/myproject

In CRX, navigate to the /etc/map node.
Open (or create) the http node of type sling:Folder
Create a node called content of type sling:Mapping
Add a property called sling:match and give it a value of localhost.4502/content/
Add a property called sling:internalRedirect and give it a value of /content/myproject

Now navigate to http://localhost:4502/content/mypage.html. The browser will display the URL that was entered, but internally AEM will be referencing the mapped directory structure.

 

Reference Link:- https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html#root-level-mappings

I hope this will help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
amrit1993
amrit1993Author
Level 3
June 15, 2016

Hi,

used the vanity URL feature, now working fine.

April 4, 2020