http to https
Hello,
We just had a new wildcard installed for one of the domains on the server. On one of the subdomains it automaticlly transfers when you go to http it goes to https as it should. On the others it does not. Is there a way to set this for this domain and all subdomains in one setting change? But also, if https does not exist it goes does not create a failure somehow?
Also, when i want port 2087, 2083 and 2096 secured with a certificate as 2086, 2082 and 2075 now redirect me to the secured ones (or should be), can i buy any ssl certificate to secure these all in one go or do i need wildcard or mulitple for this?
-
Hello :) 1. You can try using the following rule in your .htaccess file within the public_html directory: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
However, you will need to ensure a SSL certificate is already installed for the domain name. 2. You can purchase a certificate for the hostname of the server and install it via: "WHM Home " Service Configuration " Manage Service SSL Certificates" Thank you.0 -
try using the following rule in your .htaccess file within the public_html directory:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Love it! I can offer some possible *improvements* =)RewriteCond %{HTTPS} !=on
Yes, yes, I know... HTTPS is either on or off... yet in this case since we are most interested in forcing all to https I feel we should look for anything that is not explicitly 'on' - this is more along the lines of personal flavor though, unless someone knows more about how the logic works here =)RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
This is the big one! Since we are using server variables here we do not need to spend the overhead for a value capture () and we don't need to use the expensive .* wildcard match since we want this to match all requests and we know for certain that all lines begin from a void... =)[R=301,L]
Also, its likely that many folks will be wanting to set a 301 redirect rather than default 302 and unless one knows better I'm assuming that its also likely a good idea to set L =) So... all together now:RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Cheers, Max0
Please sign in to leave a comment.
Comments
2 comments