I am having issues with routing users to different domains on a shared hosting account. Each of these domains are separate Drupal installations with separate databases. site
is intended to be the production environment, and site1-test
is where we do our development and testing of content and modules prior to upload to the main site. Also, if it has any impact on this issue, clean_urls
are enabled.
Here is my file structure
+ public_html
+ site1
+ site1-test
site1
should route to www.site1.com (or site1.com)
site1-test
should route to www.site1.com/site1-test
(or site1.com/site1-test
)
To me, this should be fairly straightforward updating of the .htaccess files.
Here is what I have done so far:
public_html/.htaccess
Options +FollowSymLinks
RewriteEngine on
#========================================================================
# FIRST Handle the http requests first before removing the additional url junk
#========================================================================
#rule for site1.com to link to site1 directory
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteCond %{REQUEST_URI} !^/site1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site1/$1
#rule for site1.com/site1-test to link to site1-test directory
RewriteCond %{HTTP_HOST} ^(www.)?site1.com/site1-test$
RewriteCond %{REQUEST_URI} !^/site1-test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ /site1-test/$1
#rule for site1.com to link to site1folder directory
#==========================================================
# SECOND Remove the additional url junk once the new url is loaded
#==========================================================
#rule for site1 url rewrite to remove /site1/index.php from the URL
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteRule ^(/)?$ site1/index.php
#rule for site1-test url rewrite to remove /site1-test/index.php from the URL
RewriteCond %{HTTP_HOST} ^(www.)?site1-test$
RewriteRule ^(/)?$ site1-test/index.php
public_html/site1/.htaccess and public_html/site1-test/.htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
#RewriteRule ^ index.php [L]
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# no changes within <IfModule mod_headers.c> ...
public_html/site1/sites/default/settings.php
...
$base_url = 'http://www.site1.com';
...
public_html/site1-test/sites/default/settings.php
...
$base_url = 'http://www.site1.com/site1-test';
...
public_html/site1-test/sites/default/settings.php
So, there are multiple issues that I have. With the code listed above, all themes and login information is completely broken when visiting www.site1.com
. However, visiting www.site1.com/site1-test
works fine, although there are some issues with the Testing module (cannot run tests from the web interface, though I think this issue is linked to something being wrong in my htaccess file).
If I comment out the base_url for site1.com (i.e., //$base_url = 'http://www.site1.com';
) then site1.com works, however all links show up as http://www.site1.com/site1
, and all navigation after leaving the front page also shows that subdirectory.
Unfortunately I don't have access to the domain registration, but I do not believe that any redirects currently exist there, simply that the domain points to the site1 subdirectory.