Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Handle old stale URLs in AEM

Avatar

Level 5

Hey guys,

 

I have a requirement wherein the site is undergoing restructuring - old pages are being deactivated/deleted & new pages coming up.

For old pages which might have been bookmarked we need to redirect them to the homepage.

The site has 1000+ pages and maintaining an change might not be an option.

 

Is manually doing Apache redirects the best way?

Or should we consider sling mappings?

 

@aanchal-sikka@arunpatidar@EstebanBustamante@Imran__Khan 

 

Thanks in advance

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@aem_noob 

We can do two things in this case:

1. Use ACS commons redirect manager for 301 redirects. These URL's can be authored by anyone who don't have AEM knowledge also. Also, it should be a 301 redirect to have good SEO ranking for that particular URL. In case of 301 redirect, SEO remove old pages from its search index.

https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/index.html

 

2. Write 301 redirect rules as part of dispatcher

https://medium.com/@toimrank/aem-301-302-redirects-bbd5a1666a00

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

@aem_noob 

We can do two things in this case:

1. Use ACS commons redirect manager for 301 redirects. These URL's can be authored by anyone who don't have AEM knowledge also. Also, it should be a 301 redirect to have good SEO ranking for that particular URL. In case of 301 redirect, SEO remove old pages from its search index.

https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-manager/index.html

 

2. Write 301 redirect rules as part of dispatcher

https://medium.com/@toimrank/aem-301-302-redirects-bbd5a1666a00

Avatar

Level 5

ACS Common's Redirect Manager is definitely a more UI friendly approach. How does it store the redirects in AEM? Is it part of mappings only? In that case it might not be the best way when compared to dispatcher redirect rules.

Avatar

Community Advisor

Hi,

 

I would go with the redirects at the dispatcher layer if these URLs are going to be used indefinitely as fallbacks for bookmarked or historical ones. Also, this will be more performant than adding that quantity of sling mappings.


Hope this helps



Esteban Bustamante

Avatar

Level 3

I agree with this approach. Redirects should be handled at dispatcher or if possible at CDN level to avoid any unnecessary traffic to AEM publish instance

Avatar

Community Advisor

Hi @aem_noob 

Sling mappings can be a better option for handling redirects in AEM. Sling mappings allow you to define URL mappings and redirects in a central location, which can be easily managed and updated. This can be especially useful when dealing with a large number of pages.

To create a sling mapping, you can create a configuration node under /etc/map with the following properties:

  • sling:match: the URL pattern to match
  • sling:internalRedirect: the internal path to redirect to

For example, to redirect all old pages to the homepage, you can create a configuration node with the following properties:

/etc/map/http/old-pages
sling:match: /content/old-pages/(.*)
sling:internalRedirect: /content/homepage.html

This will redirect any URL that matches the pattern /content/old-pages/* to /content/homepage.html.

Once the sling mapping is created, you can activate it and the redirects will take effect immediately.



Avatar

Level 5

but wouldn't that mean each request would have to be parsed by the publisher which would increase the request processing overhead.

Writing redirect rules on dispatcher takes care of the request being handled at the CDN layer itself.