Page 1 of 1

SSl Works only for non www

Posted: Mon Dec 26, 2016 12:54 pm
by e.htabar
Hi There

I use Let's Encypt to make http://domian.com as https and added
{
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domian\.com [NC]
RewriteRule ^(.*)$ https://domian.com/$1 [L,R=301]
}
to htaccess.

I tried to redirect https://www.domian.com to https://domian.com, but without success. However, http://www.domian.com (without ssl protocol) redirects to https://bidbarg.com. Can you do me a favor and help me on this isuue?

I face this problem only in firefox and IE, however in chrome it works.

Re: SSl Works only for non www

Posted: Mon Dec 26, 2016 2:12 pm
by indteam
Try

Code: Select all

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www[.].+$
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]
Certificate must cover both www and non-www https. Some provider's certs cover both for www.domain.com, but only one for domain.com.

Re: SSl Works only for non www

Posted: Mon Dec 26, 2016 2:16 pm
by Mr.Erbutw

Code: Select all

RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]
If not a single domain. If the domain is connected, the aliases will be forwarded to https,
then you need so

Code: Select all

# redirect to https site
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
# redirect to www site
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301]

Re: SSl Works only for non www

Posted: Mon Dec 26, 2016 2:36 pm
by e.htabar
Thank you for Answering

but this Certificate only for non-www !

Image

https://bidbarg.com/
https://www.bidbarg.com/

Re: SSl Works only for non www

Posted: Mon Dec 26, 2016 5:53 pm
by Mr.Erbutw
Image
Image

the site only works fine on http://www.bidbarg.com but without bidbarg.com not displayed normally

Re: SSl Works only for non www

Posted: Tue Dec 27, 2016 5:44 am
by e.htabar
Mr.Erbutw wrote:Image
Image

the site only works fine on http://www.bidbarg.com but without bidbarg.com not displayed normally
I changed Https to Http