I have to redirect port 80 to 2368 in htaccess but I\'d like to keep the requested protocol intact so that SSL doesn\'t break.
I currently have this:
Or, you might use the solution posted as an answer by Jon Lin and rewrite it to use one RewriteCond
and then set a variable as suggested in the answer by TMS.
That would look like this:
RewriteCond %{HTTPS}s ^(on(s)|offs)$
RewriteRule ^ - [env=s:%2]
RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC]
RewriteRule ^ http%{ENV:s}://sub.domain.com:2368%{REQUEST_URI} [P,QSA,L]
Or, if you prefer:
RewriteCond %{HTTPS}s ^(on(s)|offs)$
RewriteRule ^ - [env=proto:http%2]
RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC]
RewriteRule ^ %{ENV:proto}://sub.domain.com:2368%{REQUEST_URI} [P,QSA,L]