Expand my Community achievements bar.

SOLVED

Https Redirect issue

Avatar

Level 1

We have added a redirect in dispatcher  /abc.html to /xyz.html. 

When https://www.example.com/abc.html is accessed

Actual behaviour:

https://www.example.com/abc.html --> http://www.example.com/xyz.html --> https://www.example.com/xyz.com 

 

Expected Behaviour:

https://www.example.com/abc.html --> https://www.example.com/xyz.html

 

Configuration in Dispatcher:

      RewriteCond %{HTTP:X-Forwarded-Proto} !https

      RewriteCond %{HTTPS} !=on

      RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

 

How to remove the https to http redirect? Is there any other configuration needs to be added in dispatcher?

 

 

 

 

 

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

6.5
1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @karthikn!

Unfortunately, the provided information is not sufficient to give a lot of advice here.

The shared snippet from your dispatcher configuration takes care of redirecting insecure incoming requests (http) to secure ones (https) and does not seem to be related to the issue you're describing.

 

Please double check on your rewrite rules and make sure that your are preserving the protocol as HTTPS during the redirect from "abc" to "xyz". If you need additional support on that, please share your according rewrite rules. There may also be other rules interfering with your intended behavior, sometimes even at different layers (e. g. AEM instance or load balancer instead of Dispatcher) of the stack. So maybe set your log levels to debug and check dispatcher logs for further analysis.

 

Hope that helps!

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Hi @karthikn!

Unfortunately, the provided information is not sufficient to give a lot of advice here.

The shared snippet from your dispatcher configuration takes care of redirecting insecure incoming requests (http) to secure ones (https) and does not seem to be related to the issue you're describing.

 

Please double check on your rewrite rules and make sure that your are preserving the protocol as HTTPS during the redirect from "abc" to "xyz". If you need additional support on that, please share your according rewrite rules. There may also be other rules interfering with your intended behavior, sometimes even at different layers (e. g. AEM instance or load balancer instead of Dispatcher) of the stack. So maybe set your log levels to debug and check dispatcher logs for further analysis.

 

Hope that helps!

Avatar

Community Advisor

Hi,

Can you check your redirect rules?

 

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteRule ^abc.html /xyz.html [R=302,L]

 



Arun Patidar

Avatar

Community Advisor

Hi @karthikn 

 

Put the below rule at the begining of the file.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/+$ $1 [R=302,L]

Try after that.

RewriteRule ^/abc.html$ /xyz.html [R=302,L]