Dispatcher redirect rule | Multiple languages in header | Community
Skip to main content
Level 5
March 24, 2023
Solved

Dispatcher redirect rule | Multiple languages in header

  • March 24, 2023
  • 1 reply
  • 2627 views

Hi Folks,

 

I need to define redirect rule to handle where one set of languages to redirect to site.com/en.html while other set of languages to redirect to site.com/fr.html

for example cn, de, fr to redirect site.com/en.html

while 

it, ja, zh to redirect site.com/fr.html.

 

How can I define such rule?

 

Is it possible like?

 

RewriteCond %{HTTP:Accept-Language} cn,de,fr [NC]
RewriteCond %{HTTP_HOST} site.com/en [NC]

RewriteCond %{HTTP:Accept-Language} it,ja,zh[NC]
RewriteCond %{HTTP_HOST} site.com/fr[NC]

 

Any help is highly appreciated.

 

Thanks,

Pradeep

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AlbinIs1

How to define rule to handle multiple languages in one rule ? So that I can club all languages in two rules to make this simple. 

Otherwise we have to write 100 rules for 100 languages. This solution will be complex to maintain.


May be you can try something as below

RewriteCond %{HTTP:Accept-Language} ^(en|es|fr|kk) [NC]

Regards

https://www.albinsblog.com

1 reply

Level 2
March 24, 2023

You can use  Rewrite rules on Apache to redirect your HTTP request 

Apache <-> Dispatcher <-> publisher

RewriteRule site.com/en.html /content/site/en.html [Your AEM content page path to allow requests from the dispatcher ]

 

Level 5
March 24, 2023

I need to handle one set of languages to redirect to en version of the site. 2nd set of languages to redirect fr version of the site.

How to handle this scenario in dispatcher?

DPrakashRaj
Community Advisor
Community Advisor
March 25, 2023

You can write Apache rewrite rules for each individual language to have redirect to appropriate location