Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

AEM SPA URL Shortening

Avatar

Level 7

Hi,

 

I had to shorten the URL from the dispatcher, which I succeeded, but I could not view the page content on the shortened URL, but when the URL wasn't shortened, I could view the content similar to Publisher. 

 

Please guide me on how to make the page visible on Dispatcher with shorten URL.

 

 

Thanks

5 Replies

Avatar

Community Advisor

Hi @Ronnie09,

You will need to add appropriate rewrite rules on Apache level, as a complementary part for short urls.

Here is the example. There is following content structure:

/content
  /spa-site
    /en
      /home
        /faq

Given structure should be accessible under below short urls, without html extension:

/content/spa-site/en/home -> https://domain/en/home 
/content/spa-site/en/home/faq -> https://domain/en/home/faq

For above following Apache rewrite rules are applicable

RewriteEngine On

# remove html extension
RewriteRule ^/en.html$ /en [R=301,L]
RewriteRule ^/en/(.+).html$ /en/$1 [R=301,L]

# redirect / to /en
RewriteRule ^/$ /en [R=301,L]

# spa root rewrite
RewriteRule ^/en$ /content/spa-site/en.html [PT,L]

# content rewrite
RewriteRule ^/en/(.+)$ /content/spa-site/en/$1.html [PT,L]

 

Avatar

Level 7

Hi @lukasz-m 

 

I did that URL is shortening but the page is coming blank

Ronnie09_0-1685347507808.png

 

Avatar

Community Advisor

Hi @Ronnie09 

is this issue resolved? if yes, can you please mention the steps you did to get it working?

 

Thanks.

Avatar

Level 7

Hi @iamnjain 

This issue was resolved by the react team they handled via some routing element. AEM inputs are not that much required. I am also not exactlty aware what changes were made by react team.