I've set up a WordPress multi-site with a wildcard ssl for example.com to access the admin area securely. However I'm also using domain mapping to map other domains to other sites e.g. alldogs.com to alldogs.example.com.
The problem is when I'm trying to access the front end of a site from and admin for a mapped domain e.g. alldogs.com by clicking "Visit Site" the Link goes to https://alldogs.com because of the forced ssl applied to the admin area. Which produces a certificate warning since the certificate is for example.com and not alldogs.com.
How can write a mod_rewrite rule to determine if the url/link clicked on is not the main domain e.g. example.com then change the https:// to http:// so the site can be accessed via port 80 and not generate a certificate warning for that mapped domains
You can't match on the DNS name used in mod_rewrite. It only sees the query string; when a client issues
GET /foo
mod_rewrite will look at/foo
while applying rules.Instead of using relative links to link into your SSL-enabled area, try using absolute links (specify the full URL).
Even if you can get the rewrite working, you would still see the warning, because the client has to connect to the server with the "wrong" SSL and send the request, and then get the redirect.
If a rewrite is not easily doable (you can check what you can use in a condition in the mod_rewrite documentation), you can easily set up a Virtual Host for the "wrong" domain that will redirect everything to the correct URL? You would still see the warning though, no way around it.