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

AEM Redirection Not working

Avatar

Level 3

Hi Team I have a requirement to redirect every requests from  https://mypage.mywebsite.com/properties/shoppingpage-pointe.html and https://mypage.mywebsite.com/properties/the-cart.html to https://mypage.mywebsite.com/properties/shoppingpage-pointe-the-cart.html

 

I tried with below code, but it is not working as expected. 

Could you please guide me on what to be done.

 

<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 https://mypage.mywebsite.com/properties/shoppingpage-pointe.html https://mypage.mywebsite.com/properties/shoppingpage-pointe-the-cart.html
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 https://mypage.mywebsite.com/properties/the-cart.html https://mypage.mywebsite.com/properties/shoppingpage-pointe-the-cart.html
</IfModule>

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@vineetham123 

Please try below rule once

RewriteRule /properties/(shoppingpage-pointe|the-cart)* /properties/shoppingpage-pointe-the-cart.html [R=301,L]

View solution in original post

5 Replies

Avatar

Level 4

Hi @vineetham123 

 

You can try the below rewrite rules in your rewrite rules file

 

RewriteCond %{REQUEST_URI} ^/properties/(shoppingpage-pointe|the-cart).html
RewriteRule ^/(.*)$ /properties/shoppingpage-pointe-the-cart.html  [PT,L]

 

Regards

Ayush

Avatar

Correct answer by
Community Advisor

@vineetham123 

Please try below rule once

RewriteRule /properties/(shoppingpage-pointe|the-cart)* /properties/shoppingpage-pointe-the-cart.html [R=301,L]

Avatar

Community Advisor

Hi @vineetham123 

You can try using the following code 

<IfModule mod_rewrite.c>
RewriteRule ^properties/shoppingpage-pointe\.html$ /properties/shoppingpage-pointe-the-cart.html [R=301,L]
RewriteRule ^properties/the-cart\.html$ /properties/shoppingpage-pointe-the-cart.html [R=301,L]
</IfModule>

This code uses regular expressions to match the URLs and redirect them to the desired URL. 



Avatar

Community Advisor

You can try 

RewriteRule ^/(properties)/(shoppingpage-pointe|the-cart).html$ /$1/shoppingpage-pointe-the-cart.html [R=301,L]


Arun Patidar

Avatar

Administrator

@vineetham123 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni