0

I need to redirect the following instances to https://www.mydomain.com;

I have the following in my .htaccess already, but this only redirects mydomain.com to https://www.mydomain.com;

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
  RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

Grateful if anyone could perhaps tell me what I need to add. Thank you.

migrated from stackoverflow.com Nov 12 '11 at 8:59

This question came from our site for professional and enthusiast programmers.

1

Remove the second RewriteCond so you filter ONLY on the https status, and not anything to do with the requested host. That'll make it an unconditional redirect, regardless of how the site was requested

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.