<p>ModRewrite can easily handle stripping the www off the front of my domain.<br>
In .htaccess:</p>

<pre><code>RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</code></pre>

<p>But with SSL, the certificate check comes before the .htaccess rewrite, causing certificate error.<br>
I would rather not buy an SSL certificate for the www only to redirect it.<br>
Can you offer me a smarter solution?
(btw EV Certificates are not available as wildcards)</p>

You can get certificates with multiple domain names in them. Get one with
```
mydomain.com
```
and
```
www.mydomain.com
```
. I think it's also possible to buy "wildcard" certificates that will match any subdomain, but they cost much more.