Question

I have 2 domains, a .eu and .com. The .eu domain points to my .com site. This works fine, except my SSL certificate is for the .com domain. So if someone types in

https://wwww.mydomain.eu/somedirectory/default.aspx

I want to rewrite the url to the .com, so I dont get a SSL issue

https://wwww.mydomain.com/somedirectory/default.aspx

Here is my web.config snippet

<rule name="Redirect for .eu" enabled="true" stopProcessing="true">
    <match url=".eu$" />
    <action type="Redirect" url="http://www.mydomain.com{R:0}" appendQueryString="false" />
 </rule>

Will this work?

Was it helpful?

Solution

URL re-writing is not what you think it is, and it cannot solve your SSL issue. Only a proper certificate can. That's why we have SSL security in the first place.

Here's what URL re-writing does: The URL provided by your user is translated within your server into another URL so that your server knows which script to process. The user and the user's browser don't even know this is happening if it's done right. For example, if the user requests URL http://www.mydomain.com/ballyhoo, your server could rewrite it (to itself, because that's the only way!) as http://www.mydomain.com/q.aspx?term=ballyhoo and then your server's q.aspx would continue handling the request. The user gets the convenience of a simple URL, and the server gets the convenience of processing lots of different looking requests by the same script.

Now back to your problem. Your users are securely requesting something from your .eu domain, and you don't have the proper certificate. It would be a terrible security hole if you could automatically redirect them to another domain without making them aware of the security implications. That's why such a scenario is not allowed. Web browsers are just doing their job of protecting users.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top