R
R
Radmir2016-05-21 15:18:51
htaccess
Radmir, 2016-05-21 15:18:51

Correct redirect from www.site.com to https://site.com - via .htaccess?

There is a website sunnyappliancerepair.com We
bought a certificate, specified it in the isp settings and set a request redirect from http to https

Also in htaccess there is such a redirect for requests from www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

So the problem is that in Firefox, when you open it, just www.sunnyappliancerepair.com does not redirect and generally swears at the certificate.

How to set it all up correctly so that it redirects to https://sunnyappliancerepair.com/

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Seva Sargsyan, 2016-05-21
@sevasargsyan

Maybe it will help

S
Sergey, 2016-05-27
@DDanser

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule (.*) https://site.ru/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [L]
RewriteRule .* ./index.php [L,QSA]

RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC] 
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question