0
votes

I want to redirect every possible url combination to single path.

For eg.

http:/example.com ---> https:/example.com/abc/cde

https:/example.com --> https:/example.com/abc/cde

http:/example.com/abc/cde --> https:/example.com/abc/cde

I am able to do with 1 and 3 case by following mod_rewrite setting but not able to execute 2 redirect can some one help.

I have escape one / in website examples just to avoid link conversion.

RewriteEngine On

RewriteCond %{HTTPS} off

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

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

1

1 Answers

1
votes

You should use the [OR] Rewrite Flag

 RewriteEngine On
 RewriteCond %{HTTPS} off [OR]
 RewriteCond %{HTTP:X-Forwarded-Proto} !https
 RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]