Copied to clipboard

Flag this post as spam?

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


  • Sam 184 posts 209 karma points
    Nov 26, 2010 @ 09:51
    Sam
    0

    Adding trailing "/" after flat URL

    Hi Everyone,

    I've been reading the various instructions on how to take off the .aspx from the end of URL's and I have managed to do that using the method on the bottom of this page:

    http://our.umbraco.org/wiki/install-and-setup/setting-up-umbraco-for-friendly-urls

    • Set the umbracoUseDirectoryUrls key on true;
    • Locate <httpModules> node and add a single attribute preCondition into the UrlRewriteModule node; it is required that the attribute is empty. Your entry should look like this: <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" preCondition="" />

    This works fine but I needed to add a trailing "/" on the end instead

    ie www.mysite.com/home/

    rather than

    www.mysite.com/home (I have this at present)

    I have read various topics but I'm still confused as to whether this is a 301 redirect thing or I have to change the rewrite rules? Any advice would be greatly appreciated. I can also see the issue with SEO and duplicate content:

    ie www.mysite.com, www.mysite.com/home, www.mysite.com/home/ and www.mysite.com/home.aspx are all the same?! How do you get round this?

    Any help or links to topics I've missed would be great. Thanks in advance :)

  • Sam 184 posts 209 karma points
    Nov 26, 2010 @ 09:53
    Sam
    0

    Sorry, posted this twice and the other thread wont delete? I get the 'thread deleted' page and then back on the forum, it's still there.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 26, 2010 @ 10:29
    Lee Kelleher
    2

    Hi Sam,

    The quickest and "easiest for SEO" way around this is to use a canonical link to specify the URL.

    Take a look at the Canonical meta link package - or roll your own?

    As for doing it the "proper way" - there are a few options, but all revolve around URL rewriting.  You could use the built-in UrlRewriting.net (via the /config/UrlRewriting.config), or using IIS7 rewrite rules (via the Web.config) ... or use something else? e.g. an ISAPI_Rewrite module to make use of .htaccess files (often easier because there are LOADS of .htaccess examples out there!)

    Cheers, Lee.

     

  • Sam 184 posts 209 karma points
    Nov 26, 2010 @ 17:02
    Sam
    0

    Thanks Lee,

    I'll give it a shot via web.config. Not 100% where to put the rules though, will experiment.

    Sam.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 26, 2010 @ 17:06
    Lee Kelleher
    0

    Hi Sam,

    There's an introduction article over on IIS.net: http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/

    It was written a couple of years ago - just before IIS7 was release, so it does reference the module as a download, but ignore that, as it is a part of IIS7 now!

    Cheers, Lee.

  • Sam 184 posts 209 karma points
    Nov 27, 2010 @ 11:03
    Sam
    1

    This works for me just fine:

                        <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="{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>

    Thanks for the help Lee and the link/info, will read up more about it for future reference :)

    Regards,

    Sam.

  • Max Öhman 42 posts 71 karma points
    Nov 29, 2010 @ 14:37
    Max Öhman
    0

    Thanks this helped me!

Please Sign in or register to post replies

Write your reply to:

Draft