Rewriting URLs - Problem with relative URLs on Theme/MasterPage
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.
Some more insight into the problem.
~/App_Themes/
/App_Themes/
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);
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