Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

AEM rewrite rule to redirect URL with selectors

Avatar

Level 2

Hi. 

 

We have a rewrite rules where it's getting value of a cookie and adds it in the URL as selector.

However, the redirect functionality in the page properties is not working when the URL has the selector. 

 

Below is our rewrite rule to add the selector. 

RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{HTTP_COOKIE} bid=([^;]+) [NC]
RewriteRule ^/(.*)/$ /content/${CONTENT_FOLDER_NAME}/au/en/$1.b-%1.html [PT,L]

Can someone help me on how to create a rewrite rule to redirect if URL has a selector? 

I'm still new on rewrite rules and any help is greatly appreciated. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

You can check sample rules here

https://www.askapache.com/htaccess/htaccess-fresh/

and try at https://htaccess.madewithlove.com/ 

Arun Patidar

AEM LinksLinkedIn