Rewriting URLs - Problem with relative URLs on Theme/MasterP

Posted by Community Admin on 04-Aug-2018 23:38

Rewriting URLs - Problem with relative URLs on Theme/MasterPage

All Replies

Posted by Community Admin on 31-May-2012 00:00

Hi there,

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

For links like this with query strings: 

I want it to appear as :

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.



Karandeep Singh

Visual Statement Inc.

Posted by Community Admin on 01-Jun-2012 00:00

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

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;

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
VisualStatement Inc.

Posted by Community Admin on 01-Jun-2012 00:00

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 
Rewritten as:  

But I would still like to know if there is a solution to the problem that I had. 

This thread is closed