wildcart redirect? - http://www.mydomain.com -> http://mydomain.com

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Hi all

I want to redirect all request to a certain subdomain to http://sub.domain.com - due to the fact that there's a SSL on that domain

So, if someone were to type in http://www.sub.domain.com, I need it to be rediredted to https://sub.domain.com, but can't see to figure out how.


Here's the code I have so far:

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

The problem is, if someone needs to access https://sub.domain.com/folder1/download/file.zip, but types in http://www.sub.domain.com/folder1/download/file.zip, he get's redirected to https://sub.domain.com

What am I missing?

tia :)