Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to do sling:internalRedirect pointing an internal ws call

Avatar

Level 1

I like to reproduce the same action I have in Apache on etc/map

RewriteRule ^/sitemap.xml http://localhost:%{ENV:aemPort}/services/sitemap/map.xml [P]

the /services/sitemap/map is a service resource.

Right now I have it like this:

    jcr:primaryType="sling:Mapping"

    sling:internalRedirect="/services/sitemap/map.xml"

    sling:match="\[^/]+/map.xml"/>

But for some reason is not working is throwing me a 404, is like after he get the etc/map match he don't return to validate againg the servlets or service resource validation.

Also is it possible to have an internalRedirect pointing to an external domain?

something like this RewriteRule ^/page1$ http://www.external-site.com/page1.html [L,P]

Thanks

4 Replies

Avatar

Level 10

See these docs - i am not sure that you can make an external WS call however --

Apache Sling - Mappings for Resource Resolution

Avatar

Level 1

I used that link as references but not luck

    jcr:primaryType="sling:Mapping"

    sling:internalRedirect="/services/sitemap/map.xml"

    sling:match="\[^/]+/map.xml"/>

whats wrong here, I see it normal internal redirect just an exception that is going to a ws call (the ws is internal), if I use sling:redirect works but not intenal?

Avatar

Level 10

I think redirect is for internal AEM resources. However - if someone has made an external redirect work - please update this thread.

Avatar

Level 1

try property: "sling:redirect" . this will send a new request with a modified location

Reference: How to configure Internal and External Redirects in CQ5 | aemblog