Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carson Brown 15 posts 85 karma points
    Jun 15, 2016 @ 20:40
    Carson Brown
    0

    301 Redirect with multiple domains

    I am hosting multiple domains out of one installation and am having trouble with the 301 redirects. I tried using the Url Tracker package but it only would redirect to the top node on the content list. I know you can make redirect rules in the web.config, however this is also complicating because we have multiple domains and no way to differentiate which domain is running in the web.config. Is there a proper solution for this?

  • Saied 349 posts 674 karma points
    Jun 15, 2016 @ 21:31
    Saied
    0

    I literally was just about to post the same question. I have two domains:

    www.abc.com and www.def.com for example. When I set the culture and host name for www.abc.com, the Link To Document is www.abc.com, but when I set the culture and hostname of www.def.com to www.def.com, the Link To Document stays at \.

    I also installed the Url Tracker and I got it to work with www.abc.com\user which I want to redirect to www.abc.com\user\account, but when I set the same redirect up for www.def.com\user, it redirects to www.abc.com\user\account and not www.def.com\user\account.

    I have a feeling this has to do with the hostname. The funny thing is when I changed the hostname to something other than www.def.com, the Link to Document had the hostname, so is something cached somewhere?

    I also had to make sure I checked Force Redirect in Url Tracker in order to get anything to redirect because my user page is a page that exists

    Maybe since you mentioned it, it is doing a redirect using the top domain only.

    I am wondering if just writing two separate rewrite rules in urlrewriting.config is the way to go.

    I can't seem to get that to work either

  • Saied 349 posts 674 karma points
    Jun 16, 2016 @ 01:44
    Saied
    0

    I got mine working, but not sure if it is by luck. I did it this way:

    Root Node = www.abc.com

    Old URL: /user

    Redirect URL: /user/account or Redirect Node: Account

    Force Redirect is checked for me because the /user page does not throw a 404, but I still want to redirect.

    I could have sworn I did this before, so I am a bit confused on why it works now. Are the entries cached?

    UPDATE:

    If I go to the websites within my company network, it redirects wrong, outside, it redirects fine.

  • Saied 349 posts 674 karma points
    Jun 16, 2016 @ 05:11
    Saied
    0

    Nevermind,

    It stopped working. I am starting to think it is cached somewhere. It is really confusing.

  • Saied 349 posts 674 karma points
    Jun 16, 2016 @ 13:46
    Saied
    0

    Well, I just deployed to my staging server, set up the redirect again and it worked, so not sure what to think. I am guess it caches this stuff somewhere?

  • Carson Brown 15 posts 85 karma points
    Jun 16, 2016 @ 16:16
    Carson Brown
    0

    I was able to get this working by just setting up the redirects in the Web.config and having the different redirect rules for each different URL

  • Saied 349 posts 674 karma points
    Jun 17, 2016 @ 03:13
    Saied
    0

    Hi Carson,

    Would you mind sharing what you did in web.config?

    Mine acts weird...It works and then it doesn't.

  • Carson Brown 15 posts 85 karma points
    Jun 20, 2016 @ 19:06
    Carson Brown
    0

    Sorry for the late response. Web.config looks like this

    <rewrite>
      <rewriteMaps configSource="rewritemaps.config"></rewriteMaps>
      <rules>
        <rule name="Redirects for ClarkTurnKeyRedirectMap">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^.*clarkturnkey\..*$" />
            <add input="{ClarkTurnKeyRedirectMap:{REQUEST_URI}}" pattern="(.+)" />
          </conditions>
          <action type="Redirect" url="{C:1}" appendQueryString="false" />
        </rule>
        <rule name="Redirects for ElevenFourHundredRedirectMap">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^.*11400inc\..*$" />
            <add input="{ElevenFourHundredRedirectMap:{REQUEST_URI}}" pattern="(.+)" />
          </conditions>
          <action type="Redirect" url="{C:1}" appendQueryString="false" />
        </rule>
        <rule name="Redirects for ClarkCStoreRedirectMap">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^.*clarkcstore\..*$" />
            <add input="{ClarkCStoreRedirectMap:{REQUEST_URI}}" pattern="(.+)" />
          </conditions>
          <action type="Redirect" url="{C:1}" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>
    

    And the rewritemaps.config looks like this

    <rewriteMaps>
    <rewriteMap name="ClarkTurnKeyRedirectMap">
        <add key="/index.php" value="" />
        <add key="/front-of-house-reimaging.php" value="/front-of-house-reimaging" />
        <add key="/flooring-repair-and-replacement.php" value="/flooring-repair-and-replacement" />
        <add key="/walk-in-replacement.php" value="/walk-in-replacement" />
        <add key="/eco-energy-enhancements.php" value="/eco-energy-enhancements" />
        <add key="/request-project-quote.php" value="/quote-form" />
    </rewriteMap>
    <rewriteMap name="ElevenFourHundredRedirectMap">
        <add key="/experience.html" value="/experience" />
        <add key="/aboutus.html" value="/about-us" />
        <add key="/contact.html" value="/contact" />
        <add key="/project-gallery.html" value="/project-gallery" />
        <add key="/project-cape-henlopen.html" value="/projects/cape-henlopen" />
        <add key="/project-george-wolf-elementary.html" value="/projects/george-wolf-elementary" />
        <add key="/project-halifax.html" value="/projects/halifax" />
        <add key="/project-mcneil-avian-center.html" value="/projects/mcneil-avian-center" />
        <add key="/project-paradise-elementary.html" value="/projects/paradise-elementary" />
        <add key="/project-psecu.html" value="/projects/psecu" />
        <add key="/project-south-dover-elementary.html" value="/projects/south-dover-elementary" />
        <add key="/project-western-center-technical-studies.html" value="/projects/western-center-for-technical-studies" />
    </rewriteMap>
    <rewriteMap name="ClarkCStoreRedirectMap">
        <add key="/services.php" value="/services" />
        <add key="/project-gallery.php" value="/projects" />
        <add key="/about-us.php" value="/about" />
        <add key="/quote.php" value="/quote" />
        <add key="/walkin-coolers-freezers.php" value="/services/walk-in-coolers-and-freezers" />
        <add key="/open-air-cases.php" value="/services/open-air-cases" />
        <add key="/perfect-frys.php" value="/services/perfect-frys" />
        <add key="/turbochef.php" value="/services/turbo-chefs" />
        <add key="/beer-systems.php" value="/services/beer-systems" />
        <add key="/exhaust-systems.php" value="/services/exhaust-systems" />
        <add key="/shelves-racking.php" value="/services/shelves-and-racking" />
        <add key="/coffee-kiosks.php" value="/services/coffee-kiosks" />
    </rewriteMap>
    

Please Sign in or register to post replies

Write your reply to:

Draft