Hi all,
I’m seeking some advice from the AEM experts regarding a migration situation:
- Legacy site: legacy.co.uk
- New site: newsite.co.uk
Situation: I want to redirect most URLs, including the homepage, from the legacy site to the new domain while keeping a few legacy URLs active on the original domain.
As I’m not familiar with AEM, I’d appreciate guidance on whether this is possible and how to implement it.
Thanks in advance for your help!
Best regards,
Saday
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Saday,
you can do redirects from any page to another one using regex in Apache. Here is an example:
# Redirect everything except specified URLs
# This rule will match everything except certain paths
RewriteCond %{REQUEST_URI} !^/legacy-url-1$ [NC]
RewriteCond %{REQUEST_URI} !^/legacy-url-2$ [NC]
RewriteCond %{REQUEST_URI} !^/legacy-directory/ [NC]
RewriteRule ^(.*)$ https://newsite.co.uk/$1 [R=301,L]
# The URLs that remain on the legacy site can be managed by separate rules (if needed)
# Example for a specific URL you want to keep on legacy.co.uk
# RewriteRule ^legacy-url-1$ /legacy-content [L]
# If you want to make sure the homepage (root) also redirects:
RewriteRule ^/?$ https://newsite.co.uk/ [R=301,L]
However, I would recommend doing it closer to the user, ideally on CDN. In case you are using AEMaaCS, this feature just came out for Adobe-managed Fastly, see: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con....
In case you want to avoid redirects, you can also route traffic from your new site to the old site for specific URLs using origin selectors, see https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con....
Hope this helps,
Daniel
in my opinion the best way for you to do this from siteA.com to siteB.com, is just to update the contents of siteA.com to produce links like<a href="https://siteB.com">Newsletter</a>... when customers click on a link on siteA.com, it will open the siteB.com page... for new tab, go for this: <a href="https://siteB.com" target="blank">Newsletter <span class="sr-only>Opens in new tab</span></a>... this ensures that the screen readers read "Newsletter Opens in new tab", when someone uses accessibility features on their devices, and also ensures that moving away from the existing site, opens a new tab.
This strategy is being used because the old website, siteA.com is not yet disabled yet... and gracefully you'd want to redirect users from the active old website (siteA.com)... and until the entire siteA.com is completely removed, you should not completely disable siteA.com, but to store all redirects of siteA.com in the CDN to redirect the old website URL to the new one... this conserves SEO rankings as well.
Hi Saday,
you can do redirects from any page to another one using regex in Apache. Here is an example:
# Redirect everything except specified URLs
# This rule will match everything except certain paths
RewriteCond %{REQUEST_URI} !^/legacy-url-1$ [NC]
RewriteCond %{REQUEST_URI} !^/legacy-url-2$ [NC]
RewriteCond %{REQUEST_URI} !^/legacy-directory/ [NC]
RewriteRule ^(.*)$ https://newsite.co.uk/$1 [R=301,L]
# The URLs that remain on the legacy site can be managed by separate rules (if needed)
# Example for a specific URL you want to keep on legacy.co.uk
# RewriteRule ^legacy-url-1$ /legacy-content [L]
# If you want to make sure the homepage (root) also redirects:
RewriteRule ^/?$ https://newsite.co.uk/ [R=301,L]
However, I would recommend doing it closer to the user, ideally on CDN. In case you are using AEMaaCS, this feature just came out for Adobe-managed Fastly, see: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con....
In case you want to avoid redirects, you can also route traffic from your new site to the old site for specific URLs using origin selectors, see https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con....
Hope this helps,
Daniel