AEM 6.2 Dispatcher rewrite rule | Community
Skip to main content
Level 3
Dec 25, 2020 6:55 AM UTC
Solved

AEM 6.2 Dispatcher rewrite rule

Hi All,

Can someone please help to overcome this rewrite rule problem? I have an Level4 category page and want to redirect to an specific page.

 

Below is the page hierarchy - added URL of each pages

Outdoors -> Outdoor Tools & Equipment -> Lawn Mowers -> Robotic Lawn Mowers

When I click "Robotic Lawn Mowers" page it goes to below URL.
https://dtq.com/pl/Robotic-lawn-mowers-Lawn-mowers-Outdoor-tools-equipment-Outdoors/4294612702

 

What I need is, when I click "Robotic Lawn Mowers" page it should redirect to below URL. Instead of 'pl' it should redirect to 'c'

https://dtq.com/c/Robotic-lawn-mowers-Lawn-mowers-Outdoor-tools-equipment-Outdoors

 

Below are some sample rewrite rules which we have for l2/l3 category pages:

RewriteCond %{REQUEST_URI} ^/dtq/(mobile|desktop)/c/Departments$
RewriteRule ^/dtq/(mobile|desktop)/c/Departments$ /content/dtq/$1/en_us/Departments.$1.html [PT]

 

RewriteCond %{REQUEST_URI} ^/dtq/(mobile|desktop)/c/(.*)$
RewriteRule ^/dtq/(mobile|desktop)/c/(.*)$ /content/dtq/$1/en_us/Departments/$2.$1.html [PT]

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
praveenjainAccepted solution
Level 3
Dec 26, 2020 3:21 PM UTC

Hope, that rule worked, if not

Here I have listed re-write rules samples, you can get more ideas on rules from this

It contains details about flags too.

https://aemhub.blogspot.com/2020/12/basic-dispatcher-url-rewrites-rules.html

 

10 replies

praveenjainAccepted solution
Level 3
Dec 26, 2020 3:21 PM UTC

Hope, that rule worked, if not

Here I have listed re-write rules samples, you can get more ideas on rules from this

It contains details about flags too.

https://aemhub.blogspot.com/2020/12/basic-dispatcher-url-rewrites-rules.html

 

Translate
Level 3
Dec 26, 2020 4:07 PM UTC
Thanks Praveen, will revert back with an update once i complete my verification
Translate
Level 3
Dec 26, 2020 2:03 PM UTC

 

As you are looking for a rewrite rule on dispatcher that redirects to 'c'  URL

- https://dtq.com/pl/Robotic-lawn-mowers-Lawn-mowers-Outdoor-tools-equipment-Outdoors/4294612702

 

Try below:

#RewriteCond %{REQUEST_URI} !^/pl/(.*)
RewriteRule "^/pl/(.*)\$" "/c/$1" [R,L]

Translate
Level 3
Dec 26, 2020 2:08 PM UTC
Yes Praveen. Sure will give it a try. Can you please clarify what does $1 & [R,L] refer too?
Translate
Level 3
Dec 26, 2020 12:31 PM UTC

These rules does not gives us the clue how "c" getting changed to "pl". Can you mention the rootcause/rule from where it getting changed so we can correct that. Also do mention short url to full url mapping to understand content structure which might help.

Regards

Praveen

Translate
Level 3
Dec 26, 2020 1:08 PM UTC

Thanks Praveen for the response. /c/ content is coming from author and /pl/ page contents are coming from separate Nodejs code. So only till /c/ is under AEM scope. I looking for a rewrite rule on dispatcher that redirects to 'c'  URL when I click "Robotic Lawn Mowers" - https://dtq.com/pl/Robotic-lawn-mowers-Lawn-mowers-Outdoor-tools-equipment-Outdoors/4294612702

Translate
Level 3
Dec 26, 2020 5:20 AM UTC
Hi All - Anybudy knows how to achieve this ?
Translate