HTTPS redirect .htaccess issue
I own multiple domain names under single main domain as addon domain .,
i also bought ssl for main domain .
to force all non ssl to ssl i use following .htaccess code
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^$ https://www.maindomain.com/$1 [R,L]
this works fine ., but the issue is if i enter addondomain.info it also redirects to https://www.maindomain.com/addondomain.info/ .
i want only main domain to do https redirection how to do it ???
Note : if i enter www.addondomain.info instead of simply addondomain.info it works fine
-
If possible, try this settings RewriteEngine On RewriteCond %{HTTP_HOST} ^mydomain\.co.uk$ [NC] RewriteRule ^(.*)$ https://www.mydomain.co.uk/$1 [R=301,L] 0 -
[quote="gopkris2005, post: 1547201">If possible, try this settings RewriteEngine On RewriteCond %{HTTP_HOST} ^mydomain\.co.uk$ [NC] RewriteRule ^(.*)$ https://www.mydomain.co.uk/$1 [R=301,L]
Tried mate., even this does the same old result no changes :(0 -
I found the solution as follows : Add another condition to it: [QUOTE]RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ [NC] RewriteRule ^$ https://www.maindomain.com/$1 [R,L]
Also, you'll want to place this at the very top of your htaccess file so that it gets applied before any other rules.0 -
Hello :) You may also want to consider installing separate SSL certificates for each addon domain name. It's possible to install multiple certificates for domain names on the same account and IP address assuming your system supports SNI (CentOS 6 or RHEL 6 and cPanel version 11.38 or higher). Thank you. 0
Please sign in to leave a comment.
Comments
4 comments