0

I'm trying to redirect non-www to www and http to https on a SITE-WIDE level. That means for every page, not just the root domain. The below works but not when I type other pages like example.com/blog

RewriteEngine On

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

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] 

The above works, except it isn't site-wide. Its good for the root domain, but as soon as I type example.com/blog then this all doesn't work. Please provide the site-wide redirects for htaccess non-www to www and http to https. All the similar questions don't focus on site-wide redirect so please focus on this issue.

Thanks in advance.

Laydon
  • 1
  • 1
  • Possible duplicate of [How to redirect all HTTP requests to HTTPS](https://stackoverflow.com/questions/4083221/how-to-redirect-all-http-requests-to-https) – happymacarts Mar 20 '18 at 18:09
  • 1
    @happymacarts I think this is another issue not just forcing all website into https , may be there are rules in sub directories override main root rules – Mohammed Elhag Mar 20 '18 at 18:23
  • @happymacarts No, its not just http to https but also non www to www. Its a new question, I checked before to see there isnt this question. The duplicate answer you present has no non www to www and isnt sitewide. Mohammed is right. So can we get someone to answer this? – Laydon Mar 21 '18 at 14:21

0 Answers0