In a similar case, we have not found other method than use absolute path for resources files .css, js, .jpg, ... ie, we specify these sub-files with absolute web path by starting from the root slash /:
css:
<link type="text/css" rel="stylesheet" media="all" href="/My-Virtual-Root-Path/css/main.css">
js:
<script type="text/javascript" src="/My-Virtual-Root-Path/js/jquery.js"></script>
.png:
<img src="/My-Virtual-Root-Path/images/logo.png" />
You can now make your rewrite with freedom for main files PHP, HTML, JSP, ... In this case you should remake your script code to fix this.
Using this you should not rewrite resource files, ie, you rewrite only main files by adding this in your vhosts or other apache configuration file:
RewriteCond %{REQUEST_URI} \.(asp|cgi|jsp|php|php3|htm|html|pl)$
RewriteRule [foo] [bar]
Using relative path will be too complex to redirect to the good physical location, like this:
<link type="text/css" rel="stylesheet" media="all" href="css/main.css">
<script type="text/javascript" src="js/jquery.js"></script>