I\'m porting an old site to a new template and am having problems with the Windows 2008 rewrite module. The link I\'m trying to rewrite looks like this:
<one solution is that use absolute path (ex /css, or /js rather than just css/, /js but this is not looks a reliable solution since we've to change it on all files,
This is because your relative URIs have their base changed. Originally, the base is /
when the page is /product.php?id=75
, and the browser properly fills in relative links with the /
base. But when the browser goes to a page like /product/75/any-text-here
the base suddenly becomes /product/
and it tries to append that in front of all relative URLs and thus none of them load.
You can either make your links absolute, or change the URI base in the header of your pages (inbetween the <head> </head>
tags):
<base href="/">
Maybe you need one thing, maybe both, I didn't test, but this solved it for me:
1.) ADD THIS in page_load :
Page.Header.DataBind()
' Needed because we have <%# %>
codeblocks in the HEADER (seems header only causing this) WITH the AjaxControlToolkit
running on the page. That's what broke it until we put in this and put in the pound instead of = sign in the html.
2.) Add this in ASPX:
<%@ MasterType VirtualPath="~/dir1/dir2whateverdir/MasterPage.master" %>