Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • JDCuster 27 posts 159 karma points
    Jul 21, 2011 @ 20:15
    JDCuster
    0

    Trailing Slash & Directory URLS

    I enabled directory URLs. After doing so, pages I created throw a 404 if the trailing slash is included in URL.

    mydomain.com/contact will not throw an error
    mydomain.com/contact/ will throw an error

    I edited umbracoSettings.config and set addTrailingSlash to false which helps newly published pages from automatically including the slash.

    However, if the slash is added in the URL the page will fail. It is my understanding that the page should be displayed correctly with or without the trailing slash. Am I wrong in thinking that? I have concerns that other sites linking in will include the trailing slash and will receive 404s. 

    Is there a way I can configure Umbraco to display the page regardless of the trailing slash being added or not?

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 21, 2011 @ 20:51
    Peter Dijksterhuis
    0

    What kind of 404 do you get, the one thrown by umbraco or the one thrown by IIS?

    My guess is that you get the one from IIS, which means that IIS handles the directory-calls instead of letting umbraco handle that.

    Do you have wildcard-mapping set up in IIS?

    Peter

  • JDCuster 27 posts 159 karma points
    Jul 21, 2011 @ 23:22
    JDCuster
    0

    The 404 is from Umbraco, not IIS.

  • Muhammad Humayun 49 posts 79 karma points
    Aug 10, 2011 @ 17:22
    Muhammad Humayun
    0

    I have a problem with trailing slashes and directory URLS.

    Actually both are set to True in their config files. I assume that when someone tries to reach to a page say http://domain.com/page ; should redirect to the URL with trailing slash like http://domain.com/page/

    Is this possible or am i thinking wrong?

    Thanks

    Muhammad

  • Rich Green 2246 posts 4008 karma points
    Aug 10, 2011 @ 18:04
    Rich Green
    1

    Hey,

    You can do that with rewrites

     

     

     <rule name="Add trailing slash" stopProcessing="true">

              <match url="(.*[^/])$" 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="^/([0-9]+).aspx" negate="true" />

                <add input="{URL}" pattern="^.*\.(asp|aspx|axd|asmx|css|js|jpg|jpeg|png|gif|mp3)$" 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>

     

    From here http://umbraco.miketaylor.eu/2010/11/03/url-rewriting-and-seo/

    Rich

     

     

  • Muhammad Humayun 49 posts 79 karma points
    Aug 10, 2011 @ 19:04
    Muhammad Humayun
    0

    It really helped. Thanks Rich

     

Please Sign in or register to post replies

Write your reply to:

Draft