XF 2.0 Force HTTPS and new domain name via htaccess?

various ways to redirect a domain, try this:

Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
 
But this last one would not force https?
I guess just changing the last RewriteRule to https would fix that?

And would it rewrite https://www.olddomain.com, does ^ mean both http and https?

Sorry for all the questions, I think it is kind of important to get this absolutely right, so people find the millions of posts on my board :)
 
Would this work?
Code:
RewriteCond %{HTTP_HOST} !^www.newdomain\.se$ [NC]
RewriteRule ^(.*)$ https://www.newdomain.se/$1 [R=301,L]

Would [R=301,L,QSA] be wrong?
 
Thing is you need them separeta, unless I'm misubderstang.

In your old domain root directory you add the domain redirect. Then in the new domain you used the https redirect.
 
Just found that something as simple as this in the old domain might work (well it has for me on one of my sites)

Code:
Redirect 301 / https://newdomain.com/

But I still think you should force https in the new domain.

(Disclaimer: I'm not an expert, I often just use trial and error)
 
What I do is use cloudflares "redirect to https" feature and then add the Force WWW in .htaccess essentially doing both. If you don't have cloudflare then there may be a better method but you can use both code for https and forcing WWW. Either way is fine.
 
I ended up using:
Code:
    RewriteCond %{HTTPS} !=on  [OR]
    RewriteCond %{HTTP_HOST} !^www.example\.se$ [NC]
    RewriteRule ^ https://www.example.se%{REQUEST_URI} [R=301,L]
I think it might work.
Please till me if you think there is something there that is wrong.
 
Top Bottom