redirect Url (with domain) using webconfig

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 6 años
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!
Hace 6 años
Does this help https://www.nopcommerce.com/p/2363/simple-301-redirect.aspx
Hace 6 años
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.
Hace 6 años
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
Hace 6 años
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>
Hace 6 años
try this.

https://weblogs.asp.net/owscott/iis-url-rewrite-hosting-multiple-domains-under-one-site
Hace 6 años
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.
Hace 6 años
seanrock wrote:

Seems to be on the right track!
Hace 6 años
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.
Hace 6 años
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.