I have htaccess rewrite for wildcard subdomains that rewrite foo.domain.com to domain.com/index.php?id=foo. This is done using:
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} ^((www\.)?([a-z]+)\.)domain\.com [NC]
RewriteRule .? index.php?id=%3 [L]
This works fine, but the entire content of the site refers to the root, for example:
"/content/imgs/logo.jpg" or "/ajax/upload.php"
The wild-card sub-domain changes the root, and all content is referenced in:
"http://foo.domain.com/content/imgs/logo.jpg"
And the content cannot be found because it is not located in this subdomain.
I know that you can use html <base> to place the prefix in all href locations, but this does not help in javascript for ajax requests.
Is there anything that can be done in htaccess to solve this problem?
Thank.
source
share