More in this section

Forums / Bugs & Issues / Rewriting URLs - Problem with relative URLs on Theme/MasterPage

Rewriting URLs - Problem with relative URLs on Theme/MasterPage

3 posts, 0 answered
  1. Karandeep Singh
    Karandeep Singh avatar
    12 posts
    Registered:
    27 May 2010
    31 May 2012
    Link to this post
    Hi there,

    I have been trying to Rewrite specific URLs on my company website.

    For links like this with query strings:
    http://www.visualstatement.com/en/Corporate/AccidentReconstructionNews/Article.aspx?article=800786470&hdl=Police_research_pedestrian_collisions 

    I want it to appear as :
    http://www.visualstatement.com/en/Corporate/AccidentReconstructionNews/Article/800786470/Police_research_pedestrian_collisions

    I did this using URL Rewrite 2.0 for IIS 7

    The problem I ran into is that for the page with rewritten URL I am having problems with links on  my Menu tab and also on links to images and other resources.
    For example: The image resources that it was trying to access from [~/App_Themes/<something>.jpg] are now changed to a location as [~/Corporate/App_Themes/<something>.jpg]

    The attached screen shots show a Regular Page and a Page with rewritten URL for comparison.

    If you have a look at the messed up URLs in the screen shot :
    The homepage url has got two extra directories in between
    whereas other URLs for images and resources have got only one extra directory name.


    Any help with this problem is much appreciated.

     

    Thanks

    Karandeep Singh

    Visual Statement Inc.

  2. Karandeep Singh
    Karandeep Singh avatar
    12 posts
    Registered:
    27 May 2010
    01 Jun 2012
    Link to this post
    Some more insight into the problem.

    Some of the broken links are from the masterpage, so I dealt with those by replacing the relative links like
    ~/App_Themes/
    with 
    /App_Themes/


    But the problem remains with the urls generated by sitefinity.
    For example: The Menu strip actually uses the SiteTabStrip control that is basically a RadTab. The code for the control looks like:
    SiteMapNode rootNode = SiteMap.RootNode;
    foreach (SiteMapNode node1 in rootNode.ChildNodes)
    {
        RadTab tab = new RadTab();
        tab.Text = node1.Title;
        tab.NavigateUrl = node1.Url;
        this.RadTabstrip1.Tabs.Add(tab);
    }

    the Url is a relative one and looks like : ../../Home.aspx for home page. 

    I have no idea at this point about how to change this relative url to an absolute one. 


    Karandeep Singh
    Developer
    VisualStatement Inc.
  3. Karandeep Singh
    Karandeep Singh avatar
    12 posts
    Registered:
    27 May 2010
    01 Jun 2012
    Link to this post

    I have resolved the problem for now by rewriting the URL in such a way that the page at new URL is at the same directory level. Something like this:
    Original URL
    http://www.visualstatement.com/en/Corporate/AccidentReconstructionNews/Article.aspx?article=800786470&hdl=Police_research_pedestrian_collisions 
    Rewritten as:
    http://www.visualstatement.com/en/AccidentReconstructionNews/800786470/Police_research_pedestrian_collisions  




    But I would still like to know if there is a solution to the problem that I had. 
3 posts, 0 answered