You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Arnold <ca...@electrichendrix.com> on 2015/02/07 15:50:19 UTC
[users@httpd] Redirect HTTP to HTTPS
Apache 2.4.10 on SLES 12. I am trying to redirect a subdomain address from http to https. So when a user forgets to use https they will still land on the correct page. I tried using:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\. [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
this does not redirect to https. Instead you land at the http site. What in those statements are not correct? I have tried using just 1 subdomain with the same results
[users@httpd] Re: Redirect HTTP to HTTPS
Posted by Chris Arnold <ca...@electrichendrix.com>.
>> Apache 2.4.10 on SLES 12. I am trying to redirect a subdomain address from http to https. So when a user forgets to use https they will still land on the correct page. I tried using:
>>
>> RewriteEngine On
>> RewriteCond %{HTTPS} off
>> RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\. [NC]
>> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
>>
>> this does not redirect to https. Instead you land at the http site. What in those statements are not correct? I have tried using just 1 subdomain with the same results
>
>
> I have never had a problem with this one:
>
> RewriteEngine On
> RewriteOptions Inherit
> RewriteCond %{HTTPS} !=on
> RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [Last,Redirect=301]
I took the redirect match statement out of the vhost file (example.com) and made a separate vhost (sub.example.com) and now everything is working.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] RE: Redirect HTTP to HTTPS
Posted by Scott Birl <sb...@temple.edu>.
> From: Chris Arnold [mailto:carnold@electrichendrix.com]
> Sent: Saturday, February 07, 2015 9:50 AM
> To: <us...@httpd.apache.org>
> Subject: [users@httpd] Redirect HTTP to HTTPS
>
> Apache 2.4.10 on SLES 12. I am trying to redirect a subdomain address from http to https. So when a user forgets to use https they will still land on the correct page. I tried using:
>
> RewriteEngine On
> RewriteCond %{HTTPS} off
> RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\. [NC]
> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
>
> this does not redirect to https. Instead you land at the http site. What in those statements are not correct? I have tried using just 1 subdomain with the same results
>
I have never had a problem with this one:
RewriteEngine On
RewriteOptions Inherit
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [Last,Redirect=301]
-- Birl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org