Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

dispatcher redirects for other languages other than base language.

Avatar

Level 1

for example the current redirect rule is for content/project/de/de, Now I want to add redirect rule for other languages like /content/project/de/es ,  /content/pro/de/en , /content/pro/de/ro etc.

 

here condition is:

  1. The band default short url should be (/content/project/de/de) be applied only if the first path is not starting with 2 letter, ex: /tr/,/ro/,/es/...
  2. When the path starts with /tr/... then append it to the /content/projectname/de only

Can anyone help me?

 

 

# RewriteRule for the default short URL when the first path is not starting with 2 letters
RewriteCond %{REQUEST_URI} !^/[a-z]{2}/ [NC]
RewriteRule ^/([^/]{2})/(.*)$ ${B_ROOT}/$1/$2.html [PT,L]

# RewriteRule for paths starting with /{lang}/ to append them to /content/project/{lang}/
RewriteRule ^/([a-z]{2})/(.*)$ /${B_LOCATION}/$1/$2 [PT,L]
Define B_SITE "/content/project"
Define B_ROOT "${B_SITE}/de/de"
Define B_LOCATION "{B_SITE}/de"

 

2 Replies

Avatar

Community Advisor

Hi @tejuuu123 
your question is not 100% clear, could you please add examples of request and corresponding redirect requests.



Arun Patidar

Avatar

Community Advisor

@tejuuu123 

 

Please try following:

 

Define B_SITE "/content/project"
Define B_ROOT "${B_SITE}/de/de"

 

# RewriteRule for paths starting with /{lang}/ to append them to /content/project/{lang}/
RewriteRule ^/([a-z]{2})/(.*)$ /${B_SITE}/de/$1/$2 [PT,L]

# RewriteRule for the default short URL when the first path is not starting with 2 letters
RewriteCond %{REQUEST_URI} !^/[a-z]{2}/ [NC]
RewriteRule ^/([^/]{2})/(.*)$ ${B_ROOT}/$1/$2.html [PT,L]

Aanchal Sikka