Copied to clipboard

Flag this post as spam?

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


  • FarmFreshCode 225 posts 422 karma points
    Oct 06, 2011 @ 19:12
    FarmFreshCode
    0

    Hide /home/ directory in URL

    Ok so I have a site currently with URLS like:
    http://mysite.com/home/welcome/

    I don't want /home/ to show in the URL.  I want it to look like this: http://mysite.com/welcome/
    Now I know I could remove all the pages and stuff out from the "Home" node and take care of this problem. However, if I could work around it that would be great because I really like having that organization.

    So in my UrlRewriting.config file I have written this bit of code:

    <add name="hideHome"
      virtualUrl="^~/(.*)"
      rewriteUrlParameter="ExcludeFromClientQueryString"
      destinationUrl="~/home/$1"
      ignoreCase="true"
    />

    Now this code works, so that if I manually type in the address:
    http://mysite.com/welcome/
    It pulls up the page and everything looks great...

    HOWEVER.. all of my links on my site still point to URLs that include /home/ in the URL and therefore go to error 404 pages.

    How can I fix this issue? Is there a better way to hide the /home/ directory in the URLs?

    Would love some help in "Novice" terms im still pretty new to .Net in general.
    THANKS!!!

  • Greg Fyans 140 posts 342 karma points
    Oct 06, 2011 @ 19:20
    Greg Fyans
    0

    Hey,

    In the web.config there is an appSetting called umbracoHideTopLevelNodeFromPath, I think setting this to true will do what you want.

    Cheers,
    Greg. 

  • FarmFreshCode 225 posts 422 karma points
    Oct 06, 2011 @ 19:34
    FarmFreshCode
    0

    Hi Greg!

    Thanks for your pointer. That actually works great, however it's breaking my uBlogsy install since that has a topLevelNode too.. hmmm Trying to work out a way to work around that now.

  • Greg Fyans 140 posts 342 karma points
    Oct 06, 2011 @ 19:36
    Greg Fyans
    0

    Hmm that's not good, I think you'd better alert the author of that package by posting in the package forum.

    http://our.umbraco.org/projects/starter-kits/ublogsy

    I've never used uBlogsy so can't assist there unfortunately.

    Cheers,
    Greg. 

     

  • FarmFreshCode 225 posts 422 karma points
    Oct 06, 2011 @ 20:37
    FarmFreshCode
    0

    Well I was able to compensate for this via a rewrite rule:

    <add name="blogFIX"
            virtualUrl="^~/news/"
            rewriteUrlParameter="ExcludeFromClientQueryString"
            destinationUrl="~/blog/"
            ignoreCase="true"
        />

    Sooo I guess that will cover all my angles at this point.. thanks!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies