Copied to clipboard

Flag this post as spam?

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


  • Nicolas 26 posts 46 karma points
    Sep 20, 2011 @ 20:04
    Nicolas
    0

    Clean URL rewrite

    Hi,

    I've build a website with Umbraco, and I find it really powerful! One think I love in Umbraco, is that I don't need to use URL Rewriting like I would when I build a website from scratch. For me, URL Rewriting is really a problem because it makes website much more difficult to maintain.

    But, I have a problem. There is 5 differents URL to access every page of my website. Example :
    /produits.aspx
    /produits
    /produits/
    /1097.aspx
    /1097

    Moreover, they all return a 200 OK HTTP code, which is not a good think for Google (because it thinks that I duplicate my website 5 times).

    Of course, all the links in my website are pointing the adresse I want (/produits/, for instance). And I've set umbracoUseDirectoryUrls to true.

    But my question is : is there a generic way (one code for all my pages) to block URLs that I don't want (produits.aspx, 1097.aspx, 1097) so they return 404. And, is there a similar way to redirect (produits/) with a 301. Moreover, I don't want to use URL redirect for the same reasons I already told you, so I'm looking for a way to set this directly with umbraco.

     

    Regards!

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Sep 20, 2011 @ 20:38
    Dan Diplo
    0

    You could just specify the version you prefer as a canonical link in the page head:

    <link rel="canonical" href="http://www.example.com/produits" />
  • Nicolas 26 posts 46 karma points
    Sep 20, 2011 @ 21:14
    Nicolas
    0

    Thanks! I didn't this was actually existing. It can be really useful! But not for my particular problem I think.

    I just find out that there is a special UrlRewriting.config file already include in Umbraco. This is much more interesting than just doing my rewrite in the web.config. 

    So I found how to make my permanent redirect (301). But I still don't know how to block a URL. Moreover, I add a rule like this one, so all my .aspx URL will return a 404 error.

        <add name="tagfilter"      virtualUrl="^~/(.*).aspx"      destinationUrl="~/error404"      ignoreCase="true"      redirectMode="Permanent"    />

    But I'm note sure if it's the good way to do this...

     

    Regards

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Sep 20, 2011 @ 21:29
    Dan Diplo
    0

    Hi Nicolas. If your problem is that you worry Google will penalise you for having multiple URLs pointing to the same content then the canonical link is exactly what you need, as Google state:

    "If your site has identical or vastly similar content that's accessible through multiple URLs, this format provides you with more control over the URL returned in search results. It also helps to make sure that properties such as link popularity are consolidated to your preferred version."

    See http://www.google.com/support/webmasters/bin/answer.py?answer=139394 or http://www.highrankings.com/canonical-link-element for more info.


  • Nicolas 26 posts 46 karma points
    Sep 20, 2011 @ 21:39
    Nicolas
    0

    Hi!

    Google is not the only problem. It is also that I don't want my users to think they can access all my pages with 5 differents URLs. Of course, there is little chance that someone will find all of them. But still, I would prefer if I could choose which one can be accessible and which wont be.

    But thanks for the tip, I will use it for the problem of the slash or no slash at the end of my URLs ;)

    I've also find this link that I find really interesting : http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html

  • Rich Green 2246 posts 4008 karma points
    Sep 20, 2011 @ 22:48
    Rich Green
    0

    You may find Mikes blog post an interesting read http://umbraco.miketaylor.eu/2010/11/03/url-rewriting-and-seo/

    Rich

Please Sign in or register to post replies

Write your reply to:

Draft