Copied to clipboard

Flag this post as spam?

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


  • hetaurhet 245 posts 267 karma points
    Aug 06, 2011 @ 07:06
    hetaurhet
    0

    user friendly urls

    hello...

    I am using umbraco 4.7. For user-friendly urls, have followed information of http://our.umbraco.org/wiki/install-and-setup/setting-up-umbraco-for-friendly-urls  link. so now http://mydomain.com/page.aspx works with url http://mydomain.com/page/ .

    but our some of the pages have querystring parameters ... say http://mydomain.com/page.aspx?cat=2 which I want to display as http://mydomain.com/page/2/ and also it should show proper results. So is there any package available in umbraco? or is there any setting to be done?

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Aug 06, 2011 @ 15:14
    Jeavon Leopold
    0

    If you really need to do this type of querystring rewritting you can use the built in URL Rewritting to do this. Edit URLRewritting.config in the root config folder and add something like this:

    <add name="PageCategories" virtualUrl="^/page/(.*)/(\?.*)?$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/page/?cat=$1" ignoreCase="true" />
    
    Then you can read and use the querystring in your XSLT or Usercontrol etc...
    <xsl:variable name="cat"><xsl:value-of select="umbraco.library:RequestQueryString('cat')"/></xsl:variable>
  • hetaurhet 245 posts 267 karma points
    Aug 08, 2011 @ 06:15
    hetaurhet
    0

    I tried this. it is not directly converting my url with querystring say default.aspx?page=1  to default/1/  ...   but if I manualy write in addrssbar like dafault/1/  then it shows result properly ... but how can it automatically convert default.aspx?page=1  to default/1/  ?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Aug 08, 2011 @ 10:40
    Jeavon Leopold
    0

    Hi, I am not sure exactly what you mean? How are you outputting your links (XSLT, Razor) and where does the identifier in your querystring come from?

    Perhaps if you could post some code samples we can help you further.

  • hetaurhet 245 posts 267 karma points
    Aug 08, 2011 @ 15:17
    hetaurhet
    0

    I have .net usercontrol in which I am using querystring parameters.. with response.redirect .... not in xslt or razor

  • hetaurhet 245 posts 267 karma points
    Aug 09, 2011 @ 07:08
    hetaurhet
    0

    hey any further clue?

  • andy_rose 91 posts 117 karma points
    Aug 10, 2011 @ 14:59
    andy_rose
    0

    Surely if you redirecting from within a usercontrol you can redirect to your preferred url route rather that using the querystring i.e.:

     

    Response.Redirect(string.Format("default/{0}/", page));

  • hetaurhet 245 posts 267 karma points
    Aug 11, 2011 @ 06:10
    hetaurhet
    0

    ok.. .will try and revert

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Aug 11, 2011 @ 11:13
    Jeavon Leopold
    0

    Yes, exactly, you need to output these custom URL's yourself, the NiceURL method will not generate these for you.

  • hetaurhet 245 posts 267 karma points
    Aug 11, 2011 @ 17:38
    hetaurhet
    0

    Jeavon,

    it means that wherever I have specified default.aspx?cat=high&page=2 ... I have to replace that with Default/high/2/  ?  i.e. in my C# code? as I am using .net user control.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Aug 11, 2011 @ 17:48
    Jeavon Leopold
    0

    Yes, that is exactly right

  • hetaurhet 245 posts 267 karma points
    Aug 11, 2011 @ 18:38
    hetaurhet
    0

    ok.. will do that.... and revert

Please Sign in or register to post replies

Write your reply to:

Draft