0

I'm trying to apply a set of htaccess rules.

I want to redirect all http requests to https, and all requests to use the subdomain webshop rather than www.

I had a look at this thread but cannot make sense of how to apply it to my case.

Currently I have

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^playmobilland.dk [NC]
RewriteRule ^(.*)$ https://webshop.playmobilland.dk/$1 [L,R=301] 

But this does not route www requests to https.

How do I add a redirect to send www requests to https as well?

Ktraving
  • 45
  • 8

1 Answers1

0

Try:

Options +FollowSymLinks 
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www.playmobilland.dk [NC]
RewriteRule ^(.*)$ https://webshop.playmobilland.dk/$1 [L,R=301]
J-M.D
  • 189
  • 1
  • 6
  • Thanks for the suggestion. I have added the extra line and understand the logic of ic. I'm not sure if there is some kind of server-side caching, but apparently the change doesn't make any difference. – Ktraving Nov 19 '18 at 07:12
  • Did you try redirecting all traffic to https (forgetting about the subdomain part, for testing purpose)? what is the result? – J-M.D Nov 19 '18 at 10:50