Domain redirect

Discussion in 'Domain names / DNS' started by chas3587, Nov 21, 2014.

  1. I have a .net and a .com for the same domain. I want anyone clicking a link or that enters the domain.com (and any page) to be redirected to the domain.net. How can I do this?

    Thank you,
     
  2. mjp

    mjp

    If you add the .com as a domain pointer (on the .net account), that's the default behavior.
     
    RayH likes this.
  3. Ray,

    I have a domain pointer on my site that points to the .com (we use it for email), but if I enter the .com address into the browser it does not redirect me to the .net domain. Do I need to set it up a special way?

    Thank you,
     
  4. Ray,

    Sorry about previous post, it is likely that the .com is redirecting, but I need it to actually show the .net domain in the browser so that I'm not required to buy another SSL Cert. for the .com, we have one for the ,net with DiscountASP. So if someone was to type https://domain.com they are redirected to https://domain.net
     
  5. martino

    martino DiscountASP.NET Staff

    mjp likes this.
  6. martino,

    I tried this suggestion in my web.config but no go. the <rewrite> tag has a warning that rewrite is not a child of system.webserver. So when I type in our domain.com in the browser it does not show domain.net.

    Here is what I added (with our domain of course):
    <rewrite>
    <globalRules>
    <rule name="Redirects to www.OurDomainHere.net" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="^OurDomainHere.*(net|com)$" />
    <add input="{HTTP_HOST}" pattern="^(www.)?OurDomainHere.(net|com)$" />
    <add input="{HTTP_HOST}" pattern="^www.OurDomainHere.com$" />
    </conditions>
    <action type="Redirect" url="https://www.OurDomainHere.net/{R:0}" />
    </rule>
    </globalRules>
    </rewrite>

    I do have a domain pointer on the domain that we need and use for email.

    Any ideas?

    Thank you,
     
  7. martino

    martino DiscountASP.NET Staff

    Where did you put this rule?

    It needs to go into the root directory's web.config file.

    By default domain pointers will always point to the root directory of your site account. Unless you have code or URL Rewrite rules to redirect/rewrite to somewhere else.
     
  8. Martino,

    I put the following in my root web.config inside the System.webServer section:

    <rewrite>
    <globalRules>
    <rule name="Redirects to www.mydomainhere.net" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="^mydomainhere.*(net|com)$" />
    <add input="{HTTP_HOST}" pattern="^(www.)?mydomainhere.(net|com)$" />
    <add input="{HTTP_HOST}" pattern="^www.mydomainhere.com$" />
    </conditions>
    <action type="Redirect" url="https://www.mydomainhere.net/{R:0}" />
    </rule>
    </globalRules>
    </rewrite>
     
  9. martino

    martino DiscountASP.NET Staff

    Did you set up the domain pointer to have the domain.com to point to the domain.net account? Did you also change your name servers for domain.com to point to our name servers below:

    NS1.DISCOUNTASP.NET
    NS2.DISCOUNTASP.NET
    NS3.DISCOUNTASP.NET

    What exactly happens when you go to: Domain.com in the web browser? Does it go to the site account on our web server or does it go to a different site not hosted by us?
     
  10. Martino,

    The DNS is pointing to DiscountASP, the web browser shows the .com URL (I want it to redirect/show the .net even if someone enters the .com), and it does open the website hosted on DiscountASP (the only one it can open).
     
  11. martino

    martino DiscountASP.NET Staff

Share This Page