Posted by philbar on June 24, 2008 at 6:01am
I'm attempting to create a Drupal site that is divided into a number of separate sub-sections:
- domain.com/sub1
- domain.com/sub2
- domain.com/sub3
I need all of those sub-directories to have their own settings.php and themes (possibly even modules) but use the same Drupal installation. I have read many tutorials on setting up sub-domains in this fashion, but I'm already using a sub-domain and need to use sub-directories for this project.
Any suggestions on how to accomplish this?
Comments
I did some researching and
I did some researching and figured out some things, but still need help.
In my drupal sites directory, I created a folder called "domain.com.sub1".
Now I'm attempting to create a php symlink at domain.com/sub1 by creating a file in that directory called "index.php" which contains the following:
<?phpsymlink( '/hsphere/local/home/--user--/domain.com/--drupal--/', 'sub1' );
?>
For some reason, the symlink doesn't do anything.
How to create the sub1
How to create the sub1 site.
If
- http://domain.com points to /home/[blah]/public_html
- Drupal is installed there
- you want to create an http://domain.com/sub1 Drupal site,
then:
ln -s /home/[blah]/public_html /home/[blah]/public_html/sub1
mkdir /home/[blah]/public_html/sites/domain.com.sub1
cp /home/[blah]/public_html/sites/default/settings.php /home/[blah]/public_html/sites/domain.com.sub1
In the third one I assumed that the settings.php file in sites/default was a fresh one, without any settings. If it wasn't, get a new one from the Drupal package and upload it to the /home/[blah]/public_html/sites/domain.com.sub1 directory.
Have the database info for sub1 ready, go to
http://domain.com/sub1
and the installer should start. Then repeat for the other sites.
I should add, my hosting
I should add, my hosting provider doesn't allow me to run commands, so the suggestion you made will not work for me. Thanks anyway. Is the symlink I created correct?
Probably.
Probably.
In your symlink() script, you have specified the full path where the symlink leads, but not the full path where the symlink 'sub1' is. So the symlink is created wherever you uploaded and ran that script.
If
- the script was uploaded and run inside your main site's directory, where your domain.com points
- that directory is the destination directory which you specified inside the script
then it is correct.
Ideally, an .htaccess
Ideally, an .htaccess mod_rewrite would be best, but I have no clue how to write any of that code.
A rewrite is useless for
A rewrite is useless for multisites. It changes the requested URL to the destination URL. So, requests for the different sites all become requests for one and the same site.
And Drupal's multisite is based on the requested URL to tell the sites apart.
I talked to my hosting
I talked to my hosting support and apparently they are able to do server-side symlinks. I don't need any help anymore, but I did want to say thanks for the time you spent to help me.