Multi-site symlinks conflicting with sub-site path aliases

emptyvoid's picture

Hello,
So here is my problem, I created a multi-site installation of Drupal using a single source tree with 50+ sub-sites using symlinks for each. The problem I have is if I try to create a page alias on a sub-site that is the same as another symlink sub-site directory Drupal will not display the page. Instead Drupal will validate the URL as the first sub-site's home page.
Here is an example

1) I have a default site at:
www.example.com

2) I have two sub-sites
www.example.com/math
www.example.com/arts

If on the math sub-site I attempt to create a page using pathauto like so:

www.example.com/math/arts

Apache and Drupal will get confused, instead of evaluating "/math/arts" are "/math/" as a symlink and "/arts" is a path alias Apache and Drupal just get confused and ignore anything after "/math/" if the path is also a symlink directory.

I should state that my symlinks all link back to the root of the Drupal installation to make the sub-sites load correctly.

Any ideas on how to fix this?

I have been researching creating a series fo mod-rewrite conditions and rules.. but still haven't got anywhere.. I really hope I don't have to hack the core to address this issue. If anyone has experienced this before I would happy to hear how you solved the problem.

Groups:
Login to post comments

Are you setting the

robertgarrigos's picture
robertgarrigos - Thu, 2009-03-26 21:21

Are you setting the $base_url variable in each settings.php file?

Robert Garrigós
Professional site: garrigos.cat


Yep URLs set per sub-site settings.php

emptyvoid's picture
emptyvoid - Thu, 2009-03-26 21:46

Hello Robert G,
Yep each sub-site has a settings file that is configured to include the base_url; each base_url contains the symlink directory.

Here is what I am working on right now but it is still giving me trouble.

.htaccess
#RewriteCond %{REQUEST_URI} ^/([^/]+)/.+$ $1 -l
#RewriteBase /$1
#RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

I am also considering on something along the lines of this.. but I don't want to "have" to do this.
http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html

The example is the last item under the External Rewriting Engine section. This would be pretty costly and may not scale well once I start to get into the realm of 100s of sub-sites..

Robert Foley Jr
Application Architect
http://www.robertfoleyjr.com || http://www.swipht.com"


I should state that my

Garrett Albright - Fri, 2009-03-27 15:32

I should state that my symlinks all link back to the root of the Drupal installation to make the sub-sites load correctly.

Woah, you're bogglin' my mind… Then how does site have its own settings.php? There's a disconnect somewhere here…


Simple really, well ok not really. :)

emptyvoid's picture
emptyvoid - Fri, 2009-03-27 16:36

Well, Drupal provides several different ways to create sub-sites the technique that I am using is a single source tree of Drupal drives all of the sub-sites.

-

-

< drupal root >
----< sites >
-------< default > <- Drupal root site
-------< www.example.com.math > <-math sub-site
-------< www.example.com.arts > <- arts sub-site

Each directory is sites is setup as:

< default > <- this is different for each site
--settings.php
---< files >

For each sub-site I have a symlink in the root pointing to the root of the Drupal installation for example:

< Drupal Root >
--- + /math/
--- + /arts/

My issue may only be related to the sub-site technique I am using (a single source tree), I am curious if anyone else has experienced this problem with setting up multiple sub-sites.. The idea of duplicating the Drupal source code for each sub-directory is not a real sub-site installation, at least not from what the handbooks have stated.

Thoughts?

Robert Foley Jr
Application Architect
http://www.robertfoleyjr.com || http://www.swipht.com


Okay, that's an interesting

Garrett Albright - Fri, 2009-03-27 16:45

Okay, that's an interesting set-up, but it sounds like everything's behaving correctly. If you're on the math site and you want to link to an arts page on the math site, you create it with just the path "arts". Its full path will then be example.com/math/arts. If you try to create it with the path "math/arts", its full path will end up as example.com/math/math/arts.

Usually when people use Drupal's standard multisite system, they're not trying to use the same full domain name with all sites. There's at least a different subdomain prefix; so instead of example.com/math and example.com/arts, there'd be math.example.com and arts.example.com. That way, symlinks aren't necessary. Maybe it's too late, but I would suggest considering a structure like that instead; it might save you and the site's other content editors some confusion in the long run.


Nope, as designed

Boris Mann's picture
Boris Mann - Sat, 2009-03-28 00:04

Actually, this is EXACTLY how multisite was designed. The symlinks are needed as described above (and are in the setup instructions) if you want to do example.com, example.com/subsite etc. etc.

And yes, the alias issue is known. If you do math/arts on example.com, underneath it's actually example.com/node/23. Basically, you're hitting some edge cases with the fact that each site doesn't know about the other.


i have also problem in one

Drupal-Tech - Thu, 2009-11-05 11:17

i have also problem in one site like i have multisite like

mysite.com/site1

here i am able to open my site from url like .. http://mysite.com/site1/site1/site1 ...
this will always open site mysite.com/site1 ... how can i restrict to access site via url like http://mysite.com/site1/site1/site1

can any one suggest .htaccess rule to restrict this?

Thanks in advance...