1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / url rewriting - browser doesn't display requested url

url rewriting - browser doesn't display requested url

6 posts, 0 answered
  1. clayman
    clayman avatar
    38 posts
    Registered:
    23 Sep 2009
    07 Dec 2009
    Link to this post
    I have url rewriting working as expected with the advanced url rewriter, but there is one annoying problem - specifically, the requested url doesn't display in the browser.

    For example, given this rule:
    <rule> 
            <url>/resources/media/videos</url> 
            <rewrite>/resources/media-library/videos</rewrite> 
    </rule> 

    If I create a link to http://domain/resources/media/videos - the correct page is served. 

    But then the browser address bar shows http://domain/resources/media-library/videos - which is the correct page but I want the user to see the requested url.

    Refer to this post, it clearly states that the requested url should be displayed... and sometimes (on a seemingly random basis) that has been the behavior. 

    But most of the time it appears that a "redirect" is happening on the server and not a url rewrite... can you help?

    Thanks
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    08 Dec 2009
    Link to this post
    Hello clayman,

    Thank you for contacting us. 

    Could you please check if you have redirect rule, for any one of the pages that should be shown? When you add additional url to a page, you can define a 301 redirect. Perhaps you have such redirect somewhere, to a page catched by the match rule of the UrlRewriter. 

    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. clayman
    clayman avatar
    38 posts
    Registered:
    23 Sep 2009
    08 Dec 2009
    Link to this post
    I don't have any redirects specified through the page admin tool.  The only redirect behaviors that I am aware of are:
    (1) the "home" page redirect
    (2) the behavior of page groups, which i am (now) trying to avoid referencing in my menus
    (3) localization (persistence mode = pathprefix)  disabling this (persistence mode = none; not an option outside of debugging) seems to help reduce the frequency of the requested url getting lost.

    It seems like the url rewriting module needs to own the request pipeline, because as other modules/behaviors are invoked the requested url is getting lost.  it's like the rewrite happens once on an inbound request and it should be happening continously until all the modules/behaviors have executed.

    the only way I am able to get the requested url to "stick" is if I avoid all of the above, which is not very realistic...  any suggestions?




  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Dec 2009
    Link to this post
    Hello Clayman,

    I am still not sure where does this redirect come from. Do you have any custom http module? If you can send us the project, we can set up it here and look for this redirect. Just let us know which is the problematic page. We can also check the project from remote (we will need the url, and possibly login credentials).

    After all, do we gave some steps which lead to constantly reproducible redirect?


    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. clayman
    clayman avatar
    38 posts
    Registered:
    23 Sep 2009
    09 Dec 2009
    Link to this post
    As far as my project goes, the site is not live yet, so I can't give you access to it.  Also, I am using the wildcard feature of IIS to not display the .aspx extensions.  These behaviors will happen either way though.

    Here are some steps you can try to reproduce consistently on your own:

    I.
    (1) create a new project.
    (2) define a home page (not at the root - e.g /root/product-pages/overview.aspx)
    (3) enable urlrewriting and define a url for the homepage that is different from the logical url (e.g. root/home.aspx)
    (4) hit your sites root - you will be redirected to the homepage but the url rewriting will not be used

    II.
    (1) create a new project
    (2) define a page within a page group (e.g. /root/products/producta)
    (3) enable urlrewriting and define a url for the page that is different from the logical url (e.g. /root/producta)
    (4) hit your page group url (/root/products) and it will redirect to /root/products/producta - the url rewriting will not be used.  FYI - this makes building a menu control that references the "new" urls based on the site map hours of fun.

    III.
    (1) using the same project as step II, enable localization - persistence == path prefix or querystring
    (2) access the new url (/root/producta) - the url will "work", but the displayed url will be changed to /root/{en}/products/producta

    IV.
    This is not so much of a test, but if you use the internal navigation controls from sitefinity to reference a pages unique id and generate the url, you will also wind up with the "old" urls being accessed on your site.  So in this case, the urlrewriting solution just doesn't quite integrate with all the features of sitefinity.

    Should point out that url rewriting has some different applications and your solution does work well for one of them, namely:  preventing old links from becoming broken (just rewrite to the new url location).  This is important for search engines, users who have bookmarked the site, and other external sites that direct traffic to your site.

    Another application would be to present clean, logical urls to the users, so that they can quickly navigate to the desired content.  When the urls are rewritten, the clean urls are lost, so while they are supported they are much less likely to be intuited by users.

    The final application is related to site metrics and usage tracking.  Business users want to use analytics to gauge effectiveness of campaigns, etc.  If the urls are getting redirected and/or if we can't present a completely unified url scheme (due to the internal link generation by page id, home page redirects, etc) then the metrics become skewed because we'll have multiple urls representing a single page.

    Provided I avoid these 4 issues, the url rewriting seems to work fine.  Going to have to use cookie persistence I guess for the localization, but that's been documented on the forums so hopefully no worries there.

    Thanks for the assistance.

  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Dec 2009
    Link to this post
    Hello Clayman,

    Thank you for your efforts in describing the issue. 

    You are right, such redirect happens indeed in cases like that, I am not sure how I missed that before..Unfortunately this is a core functionality (home page redirect, group pages redirect, and language url prefixing) so I am not sure how easy it would be for us to change it. We will definitely think about that, but there is no workaround we could provide you with right now. Still, we will spend some time today, and if there is a solution, I will follow up to this thread. 

    To disable this functionality, you will have to stop the whole CmsHttpModule.


    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered