How to provide solution in aem for 301 redirects in 6.5 | Community
Skip to main content
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 daniel-strmecki

Hey,

I see three possible options, depending on where you want redirects to happen:

1) In Apache/Dispatcher - via config

 

# Map Blank URL to the home path RewriteCond %{REQUEST_URI} !^/(apps|bin|content|etc|home|libs|system|tmp|var|saml_login|api) RewriteRule ^/$ https://%{HTTP_HOST}/%{ENV:MARKET}/%{ENV:LANGUAGE} [R=301,L]

 

2) In AEM - via Sling Mapping config

 

<short-path jcr:primaryType="sling:Mapping" sling:match="*/content*/my-project*/blog-*/(.+).html$" sling:redirect="/$1" sling:status="{Long}301" />

 

3) In CDN - example with Adobe Fastly config

 

kind: "CDN" version: "1" metadata: envTypes: ["dev"] data: redirects: rules: - name: redirect-absolute when: { reqProperty: path, equals: "/page.html" } action: type: redirect status: 301 location: https://example.com/page - name: redirect-relative when: { reqProperty: path, equals: "/anotherpage.html" } action: type: redirect location: /anotherpage

 

 

 

Hope this helps,

Daniel

2 replies

daniel-strmecki
Community Advisor and Adobe Champion
daniel-strmeckiCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
October 3, 2024

Hey,

I see three possible options, depending on where you want redirects to happen:

1) In Apache/Dispatcher - via config

 

# Map Blank URL to the home path RewriteCond %{REQUEST_URI} !^/(apps|bin|content|etc|home|libs|system|tmp|var|saml_login|api) RewriteRule ^/$ https://%{HTTP_HOST}/%{ENV:MARKET}/%{ENV:LANGUAGE} [R=301,L]

 

2) In AEM - via Sling Mapping config

 

<short-path jcr:primaryType="sling:Mapping" sling:match="*/content*/my-project*/blog-*/(.+).html$" sling:redirect="/$1" sling:status="{Long}301" />

 

3) In CDN - example with Adobe Fastly config

 

kind: "CDN" version: "1" metadata: envTypes: ["dev"] data: redirects: rules: - name: redirect-absolute when: { reqProperty: path, equals: "/page.html" } action: type: redirect status: 301 location: https://example.com/page - name: redirect-relative when: { reqProperty: path, equals: "/anotherpage.html" } action: type: redirect location: /anotherpage

 

 

 

Hope this helps,

Daniel

Level 2
October 3, 2024

Is there any solution that the text file has been placed in the  

/damadmin#/content/dam/projectName/redirects

 It is already implemented but the redirect is not working. what might be the solution in this case?

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
October 3, 2024

Hi @sudeepkonjeti,

all supported redirect options are well documented here: https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/administration/url-redirection.

In case you need your Editors to provide redirects, have a look at https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-map-manager/index.html as well.

 

Hope this helps,

Daniel