redirect Url (with domain) using webconfig

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello.

I have a new customer who wants to redirect old urls to the new webstore.

This is an example of one url:

https://www.thisisadomain.net/rings/silver

This should go to /silver-rings on the new site. (I have about 120 different redirects).

Since the new website has 5 different domain bindings i need to check the domain on the redirect as well.

Does anyone know how to do this?

Thanks in advance!
6 years ago
Does this help https://www.nopcommerce.com/p/2363/simple-301-redirect.aspx
6 years ago
seanrock wrote:

Thanks, but i was hoping this would not require a plugin. Besides, i dont see any option to use domainnames on that plugin.
6 years ago
I guess you'll be limited to using the urlrewrite module in iis. Or some other urlrewrite module.

https://www.iis.net/downloads/microsoft/url-rewrite
6 years ago
seanrock wrote:
I guess you'll be limited to using the urlrewrite module in iis. Or some other urlrewrite module.

https://www.iis.net/downloads/microsoft/url-rewrite


Or i could use rewrite rules in web config(which i want). I know how to redirect urls, but i dont know how to include the domain name.

Example of existing, working redirect:

<system.webServer>
    <rewrite>
      <rules>
        <rule name="byraa" stopProcessing="true">
          <match url="^byraa" ignoreCase="true" />
          <action type="Redirect" url="/tjenester-byraa" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
6 years ago
try this.

https://weblogs.asp.net/owscott/iis-url-rewrite-hosting-multiple-domains-under-one-site
6 years ago
lintho wrote:
Or i could use rewrite rules in web config(which i want). I know how to redirect urls, but i dont know how to include the domain name.


p.s. its the same thing. you can either write them manually or use the iis module, which creates the rules in your web.config.
6 years ago
seanrock wrote:

Seems to be on the right track!
6 years ago
seanrock wrote:
Or i could use rewrite rules in web config(which i want). I know how to redirect urls, but i dont know how to include the domain name.


p.s. its the same thing. you can either write them manually or use the iis module, which creates the rules in your web.config.



<rule name="site2.com" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^(www.)?test.azurewebsites.net" />
                <add input="{PATH_INFO}" pattern="^/diamanter/diamantringer" negate="true" />
            </conditions>
            <action type="Redirect" url="http://test.azurewebsites.net/diamantringer" />
        </rule>

This seems to redirect everything to /diamantringer EXECEPT /diamanter/diamantringer which i actually want to be redirected.
6 years ago
Finally.

This worked:

<rule name="redirect diamonds" stopProcessing="true">
            <match url="^diamonds/diamondrings" ignoreCase="true" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^(www.)?mywebshop.azurewebsites.net" />
            </conditions>
            <action type="Redirect" url="/diamondrings" redirectType="Permanent" />
        </rule>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.