<p>We are using IIS 6 and ASP.Net, When users make secure page requests using </p>

<blockquote>
  <p><strong><a href="https://somesite.com/securePage.aspx" rel="nofollow noreferrer">https://somesite.com/securePage.aspx</a></strong></p>
</blockquote>

<p>the user gets an error:</p>

<hr>

<blockquote>
  <p><strong>Error code: ssl error bad cert domain</strong></p>
</blockquote>

<hr>

<p>The certificate was issued to <strong>www.somesite.com</strong> and indicates that <strong>somesite.com</strong> uses an invalid security certificate.</p>

<p>I was hoping to be able to catch the request in the Application BeginRequest event but the SSL error occurs before this. In order to invoke the Application BeginRequest event the user needs to click through the certificate error message. Is it possible to redirect in code or does this fix need to occur within IIS?</p>

In Apache this is usually done with mod_rewrite:
```
```
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
```
```
Google for "rewrite URL IIS", you'll find some equivalents for IIS.