AEM Redirection Not working | Community
Skip to main content
Level 3
February 16, 2024
Solved

AEM Redirection Not working

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>

Imran__Khan
Imran__KhanAccepted solution
New Participant
February 16, 2024

@vineetham123 

Please try below rule once

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

5 replies

kautuk_sahni
Employee
February 16, 2024

@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.

Translate
Kautuk Sahni
arunpatidar
New Participant
February 16, 2024

You can try 

RewriteRule ^/(properties)/(shoppingpage-pointe|the-cart).html$ /$1/shoppingpage-pointe-the-cart.html [R=301,L]
Translate
Arun Patidar
Raja_Reddy
New Participant
February 16, 2024

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. 

Translate
Imran__Khan
Imran__KhanAccepted solution
New Participant
February 16, 2024

@vineetham123 

Please try below rule once

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

Translate
ayush-anand
Level 4
February 16, 2024

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

Translate