コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

Two 301 redirections are happening whenever a 301 redirect rule is applied from AEM dispatcher

Avatar

Community Advisor

We have implemented 301 redirections by adding rewrite rules to our dispatcher configurations. We see two 301 redirects are happening in network tab in our site whenever the 301 rewrite rules gets executed

 

For example in case of the page https://abcd.com/content/abc/us/en/support.html URL is hit in the browser, First 301 is happening to http://abcd.com/support.html (Where the redirect is happening to HTTP instead of HTTPS) Then next redirection happens to https://abcd.com/support.html (First request is going to HTTP and then to HTTPS) Instead it should directly redirect to https site. We are trying to check why the first redirection is happening to HTTP.

Below is the rewrite rule we added in dispatcher configurations

RewriteRule ^/content/abc/us/en/(.*)(.html)$ /$1.html [R=301]

Note: We are using AEM as a cloud service

Any help is highly appreciated

 


Amanath Ullah
1 受け入れられたソリューション

Avatar

正解者
Community Advisor and Adobe Champion

This is because your internal dispatcher is http, where when you redirect the page via 
RewriteRule ^/content/abc/us/en/(.*)(.html)$ /$1.html [R=301], you are actually redirecting the users to the http endpoint.|

it will redirect 
http://abcd.com/support.html 

https://abcd.com/support.html (because an apache rule or Azure frontdoor rule forces all requests to go to HTTPS)

 

to solve this problem, you can include the https protocol in the redirect target

RewriteRule ^/content/abc/us/en/(.*)(.html)$ https://%{HTTP_HOST}/$1.html [R=301]

 

Ideally, you should set an environment variable that includes the protocol and hostname,

https://%{HTTP_HOST}/$1

 

元の投稿で解決策を見る

1 返信

Avatar

正解者
Community Advisor and Adobe Champion

This is because your internal dispatcher is http, where when you redirect the page via 
RewriteRule ^/content/abc/us/en/(.*)(.html)$ /$1.html [R=301], you are actually redirecting the users to the http endpoint.|

it will redirect 
http://abcd.com/support.html 

https://abcd.com/support.html (because an apache rule or Azure frontdoor rule forces all requests to go to HTTPS)

 

to solve this problem, you can include the https protocol in the redirect target

RewriteRule ^/content/abc/us/en/(.*)(.html)$ https://%{HTTP_HOST}/$1.html [R=301]

 

Ideally, you should set an environment variable that includes the protocol and hostname,

https://%{HTTP_HOST}/$1