This ought to be easy, but I'm not so good at the Apache config files. I want to set up a second/third/fourth/etc website on my server such that if my drupal site is www.example.com, the others are either site2.example.com or www.example.com/site2. Is this an easy thing to do? I'm trying to keep my old pre-drupal site around as a link on the same server if it's possible...

Thanks.

Comments

cog.rusty’s picture

Usually it is very easy.

First, you can create a 'site2' subdirectory under your web root directory (for example public_html/site2) any time you want, set up your new site in there, and access it using http://www.example.com/site2. There is nothing more to it.

About subdomains, if you are on a hosted server there is usually a "Subdomains" option in the cpanel. If you create a site2.example.com subdomain there, a public_html/site2 subdirectory will be created automatically for your new site, same as in the first case. But here you will also be able to access it as site2.example.com.

If it is you own server, you may need to set up some Apache vhosts for the subdomains.

mlissner’s picture

I get it now. My drupal site is at /usr/share/drupal-5.1, so all I have to do is put files in there that I want to host, and essentially it's done. Easy enough. Thanks.

cog.rusty’s picture

One other thing, in case you encounter problems. If Drupal's .htaccess file is in the parent directory, it contains the line:

DirectoryIndex index.php

If you are going to run other kinds of applications (except php) in the subdirectories, that will interfere. So, you can change it to:

DirectoryIndex index.php index.html index.php index.asp

...etc

Or, simply add a small .htaccess file in the subdirectory, with only one line specifying the right DirectoryIndex file.

mlissner’s picture

Yeah, I've been working on this, but to no avail...I can find the pages OK, but I am getting 403 errors wherever I turn, and for some reason the CSS isn't getting loaded. I've changed the permissions to have read and execute throughout, and added the Indexes directive to the sites-enabled/default file, but it's still not working.

Do you have any ideas about that?

cog.rusty’s picture

Sorry, I don't understand.

Are you talking about a non-Drupal site installed in the subdirectory with Drupal installed in the web root? Or the opposite? Or what?

Which pages give you 403 and what kind of CSS isn't getting loaded?

mlissner’s picture

I'm not sure I follow your question either...I'm trying to server a non-drupal site such that the link will be something like www.example.com/otherSite/. I've created a directory at /usr/share/drupal-5.1/otherSite, which then automatically is getting served, but the problem I'm having is that when I go to www.example.com/otherSite, it doesn't load index.html which is in /usr/share/drupal-5.1/otherSite, nor will it display the contents of the directory.

All it gives me are 403 errors unless I deliberately spell out www.example.com/otherSite/index.html. This would be OK, except that I'm putting the old version of my site in that directory, and that version of the site relies heavily on pointing towards directories and having Apache show index.html if it's present.

Does that clarify the question a little? I hope so...

Thanks again.

cog.rusty’s picture

Ok, then
- either you Drupal .htaccess must contain the above multiple DirectoryIndex line
- or your subdirectory must contain a .htaccess containing the line DirectoryIndex index.html

If these .htaccess directives don't work, then some server setting must be preventing them or ignoring them.

About the 403 error, this happens when none of the specified index files is found in the subdirectory. If you prefer the visitors to see the list of files of the directory instead of a 403 error, then change the line Options -Indexes to Options +Indexes in Drupal's .htaccess file or in the subdirectory.

mlissner’s picture

Ah ha! I added the .htaccess file to the /usr/share/drupal-5.1/oldSite directory, and it's working well now. The odd thing now is that the CSS and javascript aren't getting loaded. It's quite odd. Any ideas about that?

This is good information. I hadn't been doing ls -a before, so I didn't realize that the .htaccess file was hiding out in the root directory.

Thanks again.

cog.rusty’s picture

That was what I was not understanding. Which CSS and javascript? Drupal's or oldSite's?

If your oldSite was moved from where it was before, check the paths in the html code and compare with where the files are now, or check the permissions.of the new directories.

mlissner’s picture

Oh, OK. It's the Java and CSS of the old site, which was moved, but the references are relative in the HTML code, and I've chmod'ed everything, so that shouldn't be a problem either...

cog.rusty’s picture

I would focus on a single particular link and try to follow what path the browser sees and where it goes.

For example a path with a front slash would resolve to the web root.

Or else I would think if I needed to put a <base href= in the <head> section.