SSL trouble

BuzzC

Registered Member
Joined
May 21, 2017
Messages
99
Reaction score
14
Hi guys,

Maybe someone here can assist? I have a site which is running under two domains .com and .co.uk (both point to same root)
and recently setup SSL certificate (installed on .co.uk). I then setup a rule in htaccess to redirect all non https urls to https. Now when I access the site via .co.uk version all is working good but when i access via .com version, the rule attaches "https" to the .com url and i get an error. Is there a way around this without getting another SSL for the .com domain?

Big thanks!
 
Your htaccess rule is to wide and you are rewriting / redirecting everything to https so it would be applied to all domains accessing the htaccess.

You need something like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]
 
Thanks will give it a go now. Had the following code in my htaccess:

RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
 
as far as i know ssl certificates can only apply to the domains and subdomains (if it is wildcard certificate) so i think you can't get both your domains under one certificate
 
If you are using a wordpress site then you can try Wp Force SSL or Really Simple SSL to fix the problem. You can use SSL to only 1 domain and you can redirects the traffic of other domain to your primary domain. You can also try Cloudflare free SSL to both of your domains. Hope this will help!!
 
Back
Top