tags:

views:

18

answers:

0

We're currently using a shared host to save on cost. We have our public website and our SaaS product hosted under virtual directories (/app and /public) on our shared host. We give vanity subdomains to our clients (i.e. client1.myproduct.com) so we have a couple of rewrite rules to make everything work correctly.

Kind of irrelvant to the actual issue, but how we've set it up is if the HTTP_HOST parameter does not start with www and if the subdomain is not empty then we redirect to /app, otherwise we show whatever is in the root.

However, problems arise with relative URLs. For instance,

~/Scripts/jQuery.js

resolves to

/app/Scripts/jQuery.js

but thanks to the rewrite rules you actually navigate to the script via

/Scripts/jQuery.js

Obviously I can change all URLs to be absolute (i.e. /Scripts/jQuery.js instead of ~/Scripts/jQuery.js) but that is suboptimal for obvious reasons.

It looks like functions like ResolveUrl use TemplateSourceDirectory to resolve relative URLs. Is it possible to overwrite it's value somewhere? Is there a better way of handling this that I'm missing?