0

As the title says, I'm having an error in chrome, I don't know if this is temporary or not however my problem is :

I want to force every single user that access my website to use https://www

I'm using this following code in my htaccess :

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ https :// www.mydomain.com/$1 [L,R=301,NC]

Some users in chrome when they access www.mydomain.com the they are redirected to:

https :// www.wwww.mydomain.com
ERR_NAME_NOT_RESOLVED
Duplicate www

But in firefox this problem doesn't happen

What is the best way to force all users of all browsers to use

https :// wwww

I'm using spaces only here, in https and www because of text editor

Thavo
  • 21
  • 4

1 Answers1

0
RewriteEngine On
### REDIRECT HTTP TO HTTPS ###
RewriteCond %{HTTPS} off
RewriteRule ^$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

### REDIRECT TO WWW ###
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Matt
  • 24
  • 3
  • When I try that code, firefox got duplicate www when I try, www.mydomain.com I go to https:://www.www.mydomain.com but chrome got fixed – Thavo May 26 '17 at 21:38
  • Ok. Try breaking up the steps. redirect to https first. Then redirect to www. I'll update the code with the steps separated. – Matt May 26 '17 at 22:15