301 Redirect for Old Static HTML Pages

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
I recently replaced a static .html site with nopCommerce 2.3 and want to force 301 redirects for specific obsolete individual pages.  What/where is the best place to do this?
12 年 前
Ok.  The reason I asked is because there appear to be numerous ways to handle redirection.  I wanted to know if there was a best practices / preferred way.  For others interested, this is what I ended up with and it appears to work fine.

In web.config, insert the following:

  <location path="oldPage.html">
    <system.webServer>
      <httpRedirect enabled="true" destination="newPage" httpResponseStatus="Permanent" />
    </system.webServer>
  </location>  


To redirect a page to the root or home folder the web.config is located in, use:

  <location path="oldPage.html">
    <system.webServer>
      <httpRedirect enabled="true" destination="." httpResponseStatus="Permanent" />
    </system.webServer>
  </location>


To redirect all references of http://myDomain.com to http://www.myDomain.com, use:

  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect to WWW" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^myDomain.com$" />
          </conditions>
          <action type="Redirect" url="http://www.myDomain.com/{R:0}"
               redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>


If there are downsides or better options, please post.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.