I want to install drupal within subdirectories on my sites, however I do not want the subdirectories as part of the URL. I have found a number of nodes that say to do this or that, however they either seem incomplete, or I cannot get them to work. Can anyone point me to a single location that explains how to do this, or can you explain it here? Thanks,

I want my life site to be http://fivecatsproductions.com with files stored in the subdirectory http://fivecatsproductions.com/drupal6 .
I want my test site to be http://fivecatsproductions.com/provinggrounds with files stored in the subdirectory http://fivecatsproductions.com/provinggrounds/drupal6 .
Anything else I install, such as family tree web app would have its own directories within both the root and the provinggrounds sections.

Thanks for any assistance,

Carolyn

Comments

groenm’s picture

For instructions on how to setup multisite support in Drupal, read the following section of the Drupal Handbook: http://drupal.org/getting-started/6/install/multi-site

With the files subdirectory, I guess you are referring to a subdirectory where Drupal is keeping downloadable files (such as attachments to pages (or nodes actually)). You could either set up your webserver to use rewrite rules to rewrite the urls of the files to the directory where they are actually stored (usually http://yoursite/sites/yoursite/files), or you could physically create the correct subdirectory, namely for your life site a drupal6 in your drupal directory, and for your test site a provinggrounds/drupal6 directory. Then set the proper files directory for your sites under Admin > Site Configuration > File System > File System Path. Make sure you have created the correct directories and set the location before you attempt to upload any file, otherwise your previously uploaded files will not be found by Drupal anymore.

Mark

carolynmarenger’s picture

I was not referring to multisite. What I am trying to figure out is how to redirect drupal so that the base url loads drupal from a subdirectory, for example
http://fivecatsproductions.com loads up the site with its files located at http://fivecatsproductions.com/drupal6. That will be my life install.

Rather than using localhost to experiment (and learn) with modules. themes and so forth, I have a second installation at http://www.fivecatsproductions.com/provinggrounds/ and its files are stored at http://www.fivecatsproductions.com/provinggrounds/drupal6.

when browsing either site, I would like to use redirection to hide the /drupal6 from the users.

Thanks,

Carolyn

groenm’s picture

I understand you use two separate drupal installations on one machine. One installation deals with the life site and the other installation with the development site.

When you refer to the files location (i.e. respectively http://fivecatsproductions.com/drupal6 and http://www.fivecatsproductions.com/provinggrounds/drupal6), maybe you mean the actual locations of the drupal installation files in the file system of your server? I doubt the urls your are providing are the actual locations in the filesystem. If you are running a Unix-like operating system, it will probably be something like /var/www/drupal6. If you are running Windows, it will probably be something like c:\whatever-directory (I am not running Windows, so I have no idea where typical http daemons store there document root). Basically, you can install Drupal wherever you like and name the directory whatever you like, for example (Unix style): /var/www/fivecatsproductions.com/life-site and /var/www/fivecatsproductions.com/developement. In the configuration file of the webserver, you can specify a document root per domain (for example for your life site http://fivecatsproductions.com/ the document root might be /var/www/fivecatsproductions.com/life-site). For your development website, whose url appears as a sub directory of the life site, you can set up a completely different document root. Look up the specific details of the web server you are running. There is quite a chance that you are running Apache, however, I stopped using Apache a couple of years ago and I can not tell you by heart what the directives are called that you need in your config file. The documentation of your web server should provide you the info though.

By the way, if the domain fivecatsproductions.com is yours, you should also be able to run your development system on a domain name like test.fivecatsproductions.com. It can be run from the same server if you want.

Mark

carolynmarenger’s picture

Thanks Mark.

Yes, fivecatsproductions.com is my domain. The server is a linux box, made sure of that when I signed up with the hosting company. I have since checked, and yes, I can create provinggrounds.fivecatsproductions.com and direct that to its own document root that is not a subdirectory of fivecatsproductions.com . In fact, I will go and do it in a moment, and get rid of the /drupal6/ subdirectories.

Your solution is elegant and simple.

Again, thanks!

Carolyn

jp2020’s picture

Hi Mark,

Can one just copy the files from the subdomain (www.test.examplesite.com) into the domain (www.examplesite.com) and the path will still work?

If working in a shared hosting. Can one have more than one domain on the public_html folder? say public_hmtl and then a folder for each domain; where each domain points to public_html/their site folder as their root domain?

One last thing. What is the best way to back up the drupal sites and its database?

Thanks,
JP

groenm’s picture

Hi Juan,

The base url is normally not configured in Drupal, except for the site directory. However, Drupal is capable of handling subdomains even if they are not configured in the sites directory. If only examplesite.com is set up in the sites directory, a request to www.examplesite.com will return pages with internal links comprising a base url of www.examplesite.com. A request to www.test.examplesite.com would return a page with internal links comprising a base url of www.test.examplesite.com. Therefore, you could set it up such that simple copying suffices. However, do not forget to also "copy" the database content.

Normally, shared hosting is not setup for handling multiple domains. You might have to ask your hosting provider to create multiple virtual domains for your account. However, I expect they will tell you to simply sign up for an extra account. However, if the DNS entries for your domain is configured to forward the domain including all subdomains (i.e. there is an entry for *.yourdomain.tld), requests for the domain including the subdomains will end up in your single public_html directory. From that point on a multi-site configuration of Drupal should be able to serve different content to the domain and the subdomains. However, this deviates from what the original poster requested. The original poster did not want to use a multi-site configuration.

To back up your site:
Manually: tar your Drupal directory and dump your database. And store both files off site. (You could write a script to do this for you and have it upload the files through FTP or SCP to another machine and invoke the script through cron.)
There are some contributed modules that can help you do backups. Check out the modules section (http://drupal.org/project/Modules) to see what suits your needs best.

Mark

carolynmarenger’s picture

Mark,

Again, I would like to thank you. It is working very nicely. Although it isn't what (I thought) I wanted, it is a very simple and clean solution to the 'real' issue I had.

Carolyn

groenm’s picture

Cheers!

One of the duties of a consultant is to not only listen to the "requirements"/"wishes" of a client as expressed by the client, but to determine what the real deeper need of the client is. Sometimes that means he will come up with a solution which appears not to fulfill the originally expressed requirement/wish. Hopefully, I managed to do just that.

Mark

amklose’s picture

Hi there groenm, I just posted a question on the forum and now I'm digging through to see if there are similar questions. I happened upon this thread, and while it's not the same question as mine, it looks like you might know the answer. Please have a look at my question at: http://drupal.org/node/908422

Thanks a bunch!

groenm’s picture

See my reply to your original message.

Mark