Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

vanity url to redirect based on geo location for aem6.5

Avatar

Level 8

Hello,

 

I would want to have the vanity url to redirect to correct geo location

 

Say I have vanity url https://www.abc.com/gk420d

 

I am based in Europe, then  I should land on /gb/en/

 

The page will look like https://www.abc.com/gb/en/abc.html

 

if I am based in US  then I should land on /us/en/

 

The page will look like https://www.abc.com/us/en/abc.html

 

How to achieve this , could you please provide pointers

 

The layers of url are

 

1>Akamai

2>AEM dispatcher

3>AEM publisher

 

Also what logger I have to add in AEM to check when  vanity url  we hit , the url it is getting redirected .

I want to check in the logger , so please provide the package details I could add for checking

 

Regards,

Srinivas

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You have to use LogLevel Directive [1] to track logs at apache level, setting logs at debug level will allow you to track request processing.

 

[1] https://httpd.apache.org/docs/2.4/mod/core.html#loglevel 

View solution in original post

5 Replies

Avatar

Level 8

Could you please provide the below

 

Also what logger I have to add in AEM to check when  vanity url  we hit , the url it is getting redirected .

I want to check in the logger , so please provide the package details I could add for checking in loggers

Avatar

Employee Advisor

I have used the below approach for one of my clients:

  1. Set a variable at CDN "Akamai-Viewer-Country", CDN will set this variable with country code like "au", "us", "de"
  2. Add apache rewrite rule file to set a variable COUNTRY like
    SetEnvIfNoCase ^Akamai-Viewer-Country$ (AU) COUNTRY=au

    SetEnvIfNoCase ^Akamai-Viewer-Country$ (DE) COUNTRY=us
  3. Add a pass-through rewrite rule to create URL for your vanity
    RewriteCond %{REQUEST_URI} ^/gk420d
    RewriteRule ^/(.*) /${COUNTRY}/en/abc.html [PT,NC,L]

 

 

Avatar

Level 8

Could you please provide the below

 

Also what logger I have to add in AEM to check when  vanity url  we hit , the url it is getting redirected .

I want to check in the logger , so please provide the package details I could add for checking

Avatar

Correct answer by
Employee Advisor

You have to use LogLevel Directive [1] to track logs at apache level, setting logs at debug level will allow you to track request processing.

 

[1] https://httpd.apache.org/docs/2.4/mod/core.html#loglevel