My server hosts all requests to example.com, i.e. example.com,
www.example.com
<http://www.google.com/url?sa=D&q=www.example.com&usg=AFQjCNFaEl-ukxNKgv1eOPdRag7GbVqELA>,
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
<http://www.google.com/url?sa=D&q=www.example.com&usg=AFQjCNFaEl-ukxNKgv1eOPdRag7GbVqELA>,
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
<http://www.google.com/url?sa=D&q=https://www.example.com/theRestOfTheURL&usg=AFQjCNGDISTggojWmiYcXiAQH5ai24SArg>
else if HTTP_HOST == 'www.example.com'
<http://www.google.com/url?sa=D&q=www.example.com%27&usg=AFQjCNGU-2mWwuFSfg9yHe1Q46Mnd6S8yQ>
and SERVER_PORT != 443
// For non-SSL requests to www, redirect to SSL www
redirect to https://www.example.com/theRestOfTheURL
<http://www.google.com/url?sa=D&q=https://www.example.com/theRestOfTheURL&usg=AFQjCNGDISTggojWmiYcXiAQH5ai24SArg>
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
<http://www.google.com/url?sa=D&q=http://HTTP_HOST/theRestOfTheURL&usg=AFQjCNEV32IOZQKDYoBo81gx8SoMLQF4bQ>
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