SSL and subdomain redirects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My server hosts all requests to example.com, i.e. example.com, www.example.com, customer1.example.com, customer2.example.com, etc. By all, I mean all that do not have a pre-defined DNS record to tell the client to go somewhere else. I have an SSL certificate that is only valid for www.example.com, not even example.com. I haven't been able to find a good answer to my question, since it involves rewrites in different cases. Here's what I want to do:

[code]
if HTTP_HOST == 'example.com'
     // All requests for example.com, regardless of SSL, redirect to SSL www site
     redirect to https://www.example.com/theRestOfTheURL
else if HTTP_HOST == 'www.example.com' and SERVER_PORT != 443
     // For non-SSL requests to www, redirect to SSL www
     redirect to https://www.example.com/theRestOfTheURL
else if SERVER_PORT == 443
     // For any other requests that are trying to use SSL, redirect to non-SSL of the same domain name
     redirect to http://HTTP_HOST/theRestOfTheURL

Carry out other RewriteRules I may have in place
[/code]

I would prefer to be able to accomplish this with .htaccess rules only. But if I need to accomplish this with a combination of .htaccess rules AND Apache configuration changes, I'm ok with that too. Thank you in advance!Let me know if you need more information.
-- 
Thanks,
Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.
ph 800-405-3148

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux