Reputation: 505
I use this code for redirecting http to https
RewriteCond %{HTTPS} off
RewriteCond %{HTTPS_HOST} !^www.tronsoeskolen.dk$ [NC]
RewriteRule ^(.*)$ https://www.tronsoeskolen.dk/$1 [L,R=301]
But it send every page with http to https://frontpage no matter it says after the domain.
Upvotes: 0
Views: 32
Reputation: 1476
Rewrite conditions are combined by AND, as long as you don't define anything else. So there is no condition for handling your request without www.
Your rules do the following:
If it is not an https request AND the request comes not from host https://www.yourdomain.xy, then rewrite to https://www.yourdomain.xy.
Combine your conditions by [OR] (example):
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
This combines the conditions to: if it is not an https request OR a request without www.
Upvotes: 1