Expand my Community achievements bar.

SOLVED

URL redirect

Avatar

Level 3

Hello all,

How to to redirect a website having a url:

www.mywebsite.com/content/en/home.html     to    just www.mywebsite.com/en

I don't think vanity url will suffice.

Any idea how to proceed ?

1 Accepted Solution

Avatar

Correct answer by
Administrator

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-l...

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

7 Replies

Avatar

Administrator

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_c...

 

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Administrator

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

Avatar

Level 3

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 ?
       

Avatar

Employee

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

Avatar

Correct answer by
Administrator

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-l...

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 3

Hi,

used the vanity URL feature, now working fine.