How to use external redirects in Adobe Experience Manager?

Reading Time: 2 minutes

Sometimes we require to redirect request to old or deprecated pages in our sites to new versions of that page or to a totaly different site. For instance, lets suppose that we decided to redirect the page to In that case, because the new page is in a different domain, we need an external redirect which is basically a Sling mapping.

Understanding sling mappings

The sling mappings expose properties that allow us to modify the way a resource is resolved. Said properties are:

  1. sling:match. Defines a partial regular expresion which be used to macth the incoming request instead of the resource name.
  2. sling:redirect. The value of this property is sent back in the Location header in the response, which causes a redirection.
  3. sling:status. The value of this property is sent back as the HTTP status to the client when we use the sling:redirect property. It defaults to 302, but you can use 300 (Multiple Choices), 301 (Moved Permanently), 303 (See Other), and 307 (Temporary Redirect).
  4. sling:internalRedirect. Multi-value property. It modifies the path internally so the path specifed in sling:match can resolve to a given resource.
  5. sling:alias. Adds an alias for a page, e.g content/myoldpage to content/mynewpage.

Creating an external redirect

First we should create the mapping under the /etc/map/http node. We have two options to create the node, we could use the namespace as the name e.g. “localhost.4502” or we can use another custom name e.g. “localhost_any” in conjunction with the “sling:match” property. For this example, we will use the first approach.

  1. Create a folder under /etc/map/http with the name "localhost.4502".
  2. Create a node inside that folder with any name you want e.g. "togoogle", the type will be "sling:Mapping"
  3. Add the following properties:
    • "sling:match" with the URL you want to be redirected, e.g. "content/oldcontent.html"
    • "sling:internalRedirect" with the URL of the page you want to redirect to, e.g. “”
    • "sling:status" choose any of the suported statuses, in thi case we will choose 301


What if the page I want to redirect to is in the same server and domain?

In that case it's not necessary to create an external redirect. Instead you can:

  1. Use a vanity url
  2. Specify and alias with a Sling mapping (sling:alias) so content/myoldpage can be considered an alias of content/mynewpage
  3. Use an internal redirect to transparently redirect content/mynewpage to content/myoldpage. Please check my previous post and its second part for more information about internal redirects.

Well, that was it for today! thanks for reading.

You May Also Like
Read More

CSS Selectors

Reading Time: 5 minutes CSS selectors are very used to apply specific rules to a bunch of elements, either to a set of…