Rewrite AEM index.html

1.2k views Asked by At

There is a rewrite issue in apache 2.4 I am trying to do the following steps but failing.

I want the result as -

If i hit url/index.html at apache(dispatcher)it should redirect and map to /content/company/en_US/index.html at AEM publisher but it should not show the long URL. Also same time all the long urls should be shortened as per second rule. Due to this conflict if i hit the url it is going to infinte loop redirects.

Also please note if AEM publisher finds /index.html it will redirect to /content.html i.e the root mapping. So i need to mask /index.html and map the same to long url without showing the long url.

  • Rule 1 :#rewrite "/index.html" home page

    RewriteCond %{REQUEST_URI} ^/index.html$
    RewriteRule ^/index.html$ /content/company/en_US/index.html [PT,L]
    
  • Rule 2 : #shorten all long URLs

    RewriteRule ^/content/company/en_US/(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
    

Kindly provide your inputs.

1

There are 1 answers

1
Rajesh Maddileti On
RewriteEngine On
RewriteRule ^/index.html /content/company/en_US/index.html [PT,L]
RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/home
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteRule ^/(.*)$  //content/company/en_US/$1 [PT,L]

Try like this it will work and please share your etc map node structure.