IIS RewriteMap Redirect URL from old path to new path in regards to AEM IIS dispatcher

Requirement:

The need is to redirect any URL from old domain along with deep URL to new Domain with new path.

total number of URLs are close to 200.

You may redirect such thing using HTTP redirect but it fails if that URL is already retired in AEM.

Example :

Source URL is https://olddomain.com/content/xx/departments/platforms/optimum-market-portfolios-/commentary/OMP_Performance_Commentary1.html

Destination URL: https://newdomain.com/xx-center/content-details.html?fragmentId=/content/dam/content-hub/content-fragments/step-by-step/account-maintenance/acct-closing-fees-0119

rewrite>
      
	  
		<rewriteMaps>
			<rewriteMap name="StaticRewrites" defaultValue="">
				<add key="/content/xx/mega-menu/best-interest-standard/sec-info-center/sec-podcasts-forums.html" value="/xx-center/content-details.html?fragmentId=/content/dam/content-hub/content-fragments/step-by-step/account-transfers/incoming-acct-xfer-0123" />
				<add key="/content/xx/departments/platforms/optimum-market-portfolios-/commentary/OMP_Performance_Commentary1.html" value="/xx-center/content-details.html?fragmentId=/content/dam/content-hub/content-fragments/step-by-step/account-maintenance/acct-closing-fees-0119" />								
			</rewriteMap>
		</rewriteMaps>
		
		<rules> 
			<rule name="CanonicalHostNameRule">	
			<match url="^(.+)" />
				<conditions>
					<add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)"/>
				</conditions>
				<action type="Redirect" url="https://newdomain.com{C:1}" redirectType="Permanent"/>
			</rule>					
		</rules>		
 </rewrite>

It works like a charm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s