Q:

Mod-Rewrite - Using usual path to css/js/images

I have some code to make www.domain.com/state/statename/folder/index.php?name=name to statename.name.domain.com. These are my codes:
RewriteEngine On

RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|bmp|png|tiff|css|js)$ [NC]

RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.(domain\.com)$ [NC] 
RewriteRule !^state/ /state/%1/folder/index.php?name=%2&page=%{REQUEST_URI} [L,NC]

The problem is now I have to use full url to link my css, js and image files. 
Also, one of the plugins in my code (AjaxLoader) Couldn't use full url to load a page in a div. Relative path such as (path/filepath.ext) does not work. 
So, is there anyway to use usual path (path/filepath.ext)? 
Thank you very much. Really appreciate your help.

A:

Can you try this rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|bmp|png|tiff|css|js)$ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.(domain\.com)$ [NC] 
RewriteRule !^state/ /state/%1/folder/index.php?name=%2&page=%{REQUEST_URI} [L,NC]

If that doesn't work then try base tag like:
<BASE href="http://statename.name.domain.com/">

