1

I have a website using the Umbraco CMS. When clicking links on the website the url will appear with the forward slash at the end. e.g. www.mysite.com/home/

Although if I type out the URL it will show www.mysite.com/home

The forward slash becomes missing.

There is a URL rewrite config but I am not sure if a config needs to be created there or in the web config.

I found something similar to my situation on this website but the solution is for the opposite, to remove the forward slash

Has anyone come across this issue or knows a solution?

Thank you.

Community
  • 1
  • 1
hdzillar
  • 77
  • 1
  • 1
  • 10

1 Answers1

3

I am using web.config to do that.

<system.webServer>
    ...
    <rewrite>
      <rules>

        <rule name="Add trailing slash" stopProcessing="true">
          <match url="(.*[^/{2,}])$" ignoreCase="true" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/install/" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/([0-9]+).aspx" negate="true" />
            <add input="{URL}" pattern="^.*\.(asp|aspx|axd|asmx|css|js|jpg|jpeg|png|gif|mp3|htm)$" negate="true" ignoreCase="true" />
            <add input="{URL}" pattern="/Base" negate="true" />
            <add input="{URL}" pattern="cdv=1" negate="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="{R:1}/" />
        </rule>

      </rules>
    </rewrite>
    ...
</system.webServer>
Davor Zlotrg
  • 6,020
  • 2
  • 33
  • 51
  • Thanks for the quick response. This works very well. I was kind of expecting to use the UrlRewrite config they provided but this did fix it. I had one issue as i use IIS for local tests. When adding this it gave me a 501 error so I had to install the package for it as explained [here](http://stackoverflow.com/questions/3332923/url-rewrite-in-iis-7-5-causes-internal-server-error) – hdzillar Jul 28 '15 at 09:32