I have a D7 installation that uses Domain Access to distinguish between a main website example.com
and a minisite event.example.com
. They share the same document root / Drupal installation and the same database. I use Domain Path to have subdomain-specific aliases.
This worked fine, until I decided to move this website to a webspace at One.com. They do this thing were you can create a subdomain just by creating a directory in the document root. So /folder/
can automatically be accesssed in three ways:
http://folder.example.com/
http://example.com/folder/
http://www.example.com/folder/
By default, there is an A
wildcard DNS-record for *.example.com
.
The relevant part of my /.htaccess
currently looks like this:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
#strip www.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
#pass all requests that do not refer to files to index.php
RewriteCond %{HTTP_HOST} ^(event\.)?example\.com [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
</IfModule>
This messes up all static files on event.example.com
. When http://event.example.com/sites/default/files/css/css_*.css
is accessed, Apache tries to find an /event/
directory, which doesn't exist and gives a 404.
I attempted to fix this by symlinking /event/
to /
. Now the static files work, but domain paths on event.example.com
no longer work (they all give 404s) and links tend to get rewritten to http://event.example.com/event/somelink
.
I also tried to fix this by adding the following, but that didn't help.
RewriteCond %{REQUEST_URI} ^/event(.*)$ [NC]
RewriteRule ^ http%{ENV:protossl}://event.example.com%1 [L,R=301]
Any ideas?