Copied to clipboard

Flag this post as spam?

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


  • Ken Sykora 17 posts 53 karma points
    Feb 14, 2012 @ 20:57
    Ken Sykora
    0

    Preventing Multiple URLs for a single page

    Hi Everyone:

    I've got a question for using Umbraco 4.1 - For each page that I create on the site, it seems that an unauthenticated user can access it via multiple URLs, especially when "directory mode" is turned on. For example:

    http://localhost/1214.aspx (preview mode)
    http://localhost/1214 (preview mode)
    http://localhost/pets/dogs/behavior/your-dog-is-talking
    http://localhost/pets/dogs/behavior/your-dog-is-talking/
    http://localhost/pets/dogs/behavior/your-dog-is-talking.aspx

    From a search/SEO standpoint, this isn't exactly ideal if these URLs end up getting picked up by a search engine like Google, as this is extremely redundant content to it. Is there any way to enforce (via a 301 redirect) that a single URL be used? Ideally it'd use the directory mode without the trailing slash

    http://localhost/pets/dogs/behavior/your-dog-is-talking

    Any idea on the best way to accomplish this before I start creating up my own IIS Module for intercepting these requests and redirecting them to the correct URL? Would preview mode break if I redirected the 1214.aspx or 1214 URLs?

  • Ken Sykora 17 posts 53 karma points
    Feb 14, 2012 @ 21:03
    Ken Sykora
    0

    Sorry - Not Umbraco v4.1,  v4.7.1.1 is what we are using.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Feb 17, 2012 @ 18:30
    Dan Diplo
    0

    I'm pretty sure that the 1234.aspx pages are required as these are the "true" pages that are then re-written using the URL rewriting module in Umbraco. I think it's better to solve the SEO problem by adding a canonical link into the page - checkout http://our.umbraco.org/projects/developer-tools/canonical-meta-link-package 

  • Paul Blair 466 posts 731 karma points
    Feb 17, 2012 @ 19:20
    Paul Blair
    0

    Another suggestion I have found is to be consistent within your sites navigation, sitemap and internal links. That way the search engines will never be exposed to the alternative URL's so will not know or care about their existence.

    As far as I am aware I have never had a SE do a search of a .aspx or /1234 page on any of my sites.

    (I'm pretty sure redirecting 1234.aspx will be a bad idea and is likely to have unintended consequences.)

  • Ken Sykora 17 posts 53 karma points
    Feb 17, 2012 @ 22:25
    Ken Sykora
    0

    OK good to know -- I'll leave it alone for now and maybe just keep an eye on google webmaster tools.

  • tentonipete 78 posts 223 karma points
    Apr 17, 2012 @ 17:11
    tentonipete
    0

    dan, have you successfully used the canonical package? just had a go and had some epic fail...

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Apr 17, 2012 @ 18:10
    Dan Diplo
    0

    Pete, I confess I haven't actually used it in anger. I assumed it worked. I think I look at the code once and it was pretty simple. Remember, you need to have head runat="server" on your pages.

  • tentonipete 78 posts 223 karma points
    Apr 17, 2012 @ 22:43
    tentonipete
    0

    Yeah. set up as documented. Oh well. Maybe it worked once! Just wrote my own better one instead :)

    seemed a bit overkill to have a package for something so simple anyway if i'm honest. 

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Apr 18, 2012 @ 11:10
    Dan Diplo
    0

    Yeah, that's essentially what I did as I thought a package was overkill.

    For people reading this you essentially need to compare the URL Umbraco generates using NiceUrl() with the actual URL being displayed (ie. Request.Url) and if they are not the same generate the canonical link using the NiceUrl. Pretty simple in a Razor script.

Please Sign in or register to post replies

Write your reply to:

Draft