Skip to main content
Level 2
February 3, 2023
Solved

AEM rewrite rule to redirect URL with selectors

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. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
Community Advisor
February 3, 2023

Hi,

You can check sample rules here

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

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

Arun Patidar

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
February 3, 2023

Hi,

You can check sample rules here

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

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

Translate
Arun Patidar