.htaccess redirect issue

Soldato
Joined
15 Feb 2003
Posts
10,048
Location
Europe
I'm trying to use the code below to redirect all traffic from http://mysite.com, and from http:/www.mysite.com
to https://mysite.com

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
RewriteRule ^(.*)$ https://mysite.com/$1 [L,R=301,NC]

I also need it to be a wildcard. In addition I also need to redirect all https://www.mysite.com to just http://mysite.com, again this too needs to be a wildcard redirect.

How do I best adapt the code to achieve this?
 
Back
Top Bottom