Copied to clipboard

Flag this post as spam?

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


  • Owen 22 posts 43 karma points
    Nov 01, 2012 @ 13:48
    Owen
    0

    Url Rewriting

    I'm making a site that will be accessible by users from the UK, US, and Ireland. The site will use different css depending on which version you are using.

    I want to differentiate the sites by having /ireland/ or /uk/ or /us/ after the root:

    http://siteName/ireland/default.aspx

    So I need to set up URL rewriting to ignore the /ireland/ and get the content from http://siteName/default.aspx, but I want /ireland/ to stay in the URL.

    I have the following rule:

    <add name="ireland"
            virtualUrl="/ireland/(.*)"
            rewriteUrlParameter="IncludeQueryStringForRewrite"
            destinationUrl="~/$1"
            ignoreCase="true"/>

    But when I browse to http://siteName/ireland/default.aspx, /ireland/ is stripped from the URL and I get http://siteName/default.aspx in my address bar.

    How do I do this so that http://siteName/ireland/default.aspx will show in my address bar, but I will see content for http://siteName/default.aspx

  • Mark Bennett 199 posts 375 karma points
    Nov 01, 2012 @ 14:01
    Mark Bennett
    0

    Owen,

    Any reason why you want /ireland/ - /uk/ or /us/ in the URL?

    If you really need them in the url then why not just set up your content tree in umbraco to have a folder at the root for uk, ireland and us?

    Mark.

  • Owen 22 posts 43 karma points
    Nov 01, 2012 @ 14:04
    Owen
    0

    There's only going to be 1 site/root in the content tree. I want ireland/us/uk in the url so that some code in the master page can decide which css should be used (and other minor changes).

  • Mark Bennett 199 posts 375 karma points
    Nov 01, 2012 @ 14:18
    Mark Bennett
    0

    Owen,

    So if you create 3 different folders and then just share the content across the 3 different folders (copy and select the option to relate the item to the original). You can then have different templates / styles for each area using the same content and it will be in 3 destinct folders on your website. In my opinion this gives you more flexibility in the future as well as you may want completely different styles/content for each of the different sites in the future.

    Mark. 

  • Owen 22 posts 43 karma points
    Nov 01, 2012 @ 16:20
    Owen
    0

    This option doesnt sound like a very good solution for us. Mainly because we dont want to have to manage content over 3 seperate sites but also because we dont want the node tree filled up with lots more nodes. Originally we were planning on creating 3 sites, but we've recently scaled that back to one site to make things simpler for development and for the users.

    I'm still thinking that a simple solution consisting of a URL rewrite rule and a switch statement in the master page to set the style sheet would be far easier.

  • Mark Bennett 199 posts 375 karma points
    Nov 01, 2012 @ 16:33
    Mark Bennett
    0

    Owen,

    So if i have this right then your site content will never be different between the US / UK and IRE so once again why do you need to have the three sites in different sub domains?

    If I am a client from the US then pick up the region from the browser and apply the stylesheet based on that / also add a flag or some kind of drop down to the site so the client can change the region if required (this would also change the css applied).

    Mark..

  • Owen 22 posts 43 karma points
    Nov 01, 2012 @ 16:47
    Owen
    0

    That's correct, the content will always stay pretty much the same.

    I've just been told that the main need for the /ireland/ /uk/ etc is because the SEO guys have demanded it saying that it will help a lot with the searches, dont ask me why, I dont know much about how it works.

    So what I need is one site, all content the same, and I need to be able to insert /ireland/ /uk/ or /us/ inbetween the domain and the rest of the URL, and no matter which country is inserted into the url, the same content will be displayed.

  • Mark Bennett 199 posts 375 karma points
    Nov 01, 2012 @ 16:55
    Mark Bennett
    0

    Owen,

    Your SEO guys understand that it will just be duplicate content in the 3 sites and that in googles eyes can be seen as deceptive and cause far more hassle than it's worth? Your SEO guys should really be telling you this and not telling you to duplicate content you might want to get some new SEO guys buddy.

    Don't just believe me have a google for it and make your mind up - these were the first few articles I came across Article 1 , Article 2 , Article 3 .

    So you might want to rethink whay you want?

    Mark.

  • Owen 22 posts 43 karma points
    Nov 01, 2012 @ 17:12
    Owen
    0

    It's not JUST for the SEO. It's also to initialise things on the pages slightly differently. For example if a user from Ireland comes to the site, the search will be preset with variables suited to irish useres. But yes the overall content of the site will be the same.

  • Mark Bennett 199 posts 375 karma points
    Nov 01, 2012 @ 17:27
    Mark Bennett
    0

    Owen,

    So as i said then you know that the client is from ireland as you will have to detect this in the http header from their browser then apply a stylesheet (or do whatever other initialising you want to do) based on that. Having a shed load of duplicate content across 3 different sub domains to handle users coming in from different regions and doing mass URL rewriting to make it all work doesn't sound like the correct solution to me.

    Mark.

     

  • Owen 22 posts 43 karma points
    Nov 01, 2012 @ 18:05
    Owen
    1

    You have made some very interesting points. I'll be forgetting about the URL rewriting for now and concentrating on other parts of the site while other people think about how to handle this situation. Thanks for making me aware of this!

  • Davide 9 posts 29 karma points
    Jan 26, 2015 @ 11:27
    Davide
    0

    Hi all, 

    I was using the URL rewriting in UMBRACO 4.7.2 on my custom Global.asax file into the Application_BeginRequest method. Now I'm trying to upgrade to version 6.0.0 where I saw that I have to change my custom Global.asax to inherit from Umbraco.Web.UmbracoApplication.

    No problems so far in general in the application, but when the global.asax triggers the HttpContext.Current.RewritePath(URL), after migrating to version 6, the method does not rewrite the URL at all. It does not give any error or exception, it simply doesn't rewrite the URL, and consequently the system returns 404 , file not found.

    Any ideas about it? Did the version 6 of Umbraco stop to support the HttpContext.Current.RewritePath method in its new Global.asax?

    Thanks in advance to all of you!

Please Sign in or register to post replies

Write your reply to:

Draft