Using URL Rewrite for SEO

To optimize your website for search engines, you can use lower case URL rewrite and remove trailing slashes.

For example, www.mysite.com/home and www.mysite.com/home/ will take the user to the same page, but the search engine interprets it as two different pages, because of the trailing slash. Therefore, the traffic count is split between the two, although they represent one and the same page. If you use URL rewrite to remove the trailing slash, www.mysite.com/home/ will be rewritten as www.mysite.com/home. The same is true, if the link contains an upper case letter. For example, www.mysite.com/Home will be rewritten as www.mysite.com/home.

To start using URL rewrite, perform the following:
  1. Install Microsoft Web Platform Installer from http://www.microsoft.com/web/downloads/platform.aspx.
  2. Run the installer and click Products in the toolbar.
  3. In the left pane, click Server.
  4. Find URL Rewrite 2.0 and click its Add button.
  5. Click Install.
  6. When the installation finishes, click Finish and exit the installer.
    The URL Rewrite 2.0 is installed on your IIS.
  7. Open the web.config file that is located in the root folder of your project.
  8. Find system.webServer tag and after the handlers section, add the following:

    <rewrite>
      <rules>
          <rule name="RemoveTrailingSlashRule1"stopProcessing="true">
            <match url="(.*)/$" />
            <conditions logicalGrouping="MatchAll"trackAllCaptures="false">
               <add input="{REQUEST_FILENAME}"matchType="IsDirectory" negate="true" />
               <add input="{REQUEST_FILENAME}"matchType="IsFile" negate="true" />
               <add input="{REQUEST_FILENAME}" pattern="(.*?)\.svc$" negate="true" />
            </conditions>
            <action type="Redirect" url="{R:1}" />
          </rule>
        <rule name="LowerCaseRule1" enabled="true"stopProcessing="true">
          <match url="[A-Z]" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_URI}"pattern="^/sitefinity/" negate="true" />
          </conditions>
          <action type="Redirect" url="{ToLower:{URL}}"redirectType="Permanent" />
        </rule>
        <rule name="Redirect WWW" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}"pattern="^sitefinity.com$" />
          </conditions>
          <action type="Redirect"url="http://www.sitefinity.com{R:0}" />
        </rule>
      </rules>
    </rewrite>

    NOTE: If you are using Sitefinity 5.1 or lower version, you must disable the LowerCaseRule1 rule if you are using Categories or Tags.

  9. Save and close the web.config file.
    The URL rewrite is activated.

Next steps

+1-888-365-2779
sales@sitefinity.com

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK