Tom Gullen
Tom Gullen

Reputation: 61727

ASP.net simple rewrite rule

I'm trying to rewrite non www to www domains.

I've tried the rule:

<rewrite url="http://domain\.com(.+)" to="http://www.domain.com$1" />

But to no avail. It just continues to allow access to htttp://domain.com

Upvotes: 0

Views: 1071

Answers (1)

Uwe Keim
Uwe Keim

Reputation: 40736

Most likely you are refering to this one ("Intelligencia URL Rewriter").

As described in their documentation, you have to add the configuration section handler as well as other configuration settings to your web.config file before you can start adding rewrite/redirect rules.

Update

Just saw you modified your question, so probably you managed to find the configuration issue.

For your domain issue, I handled something similar in one of my projects like this:

<!-- Ensure that all are on the same top domain and sub domain. -->
<unless header="HTTP_HOST" match="www.zeta-producer.com">
    <redirect 
        url="^(.*)$" 
        to="http://www.zeta-producer.com$1" 
        processing="stop" />
</unless>

Upvotes: 1

Related Questions