Hi, everyone.
I've just installed all the latest Apache/MySQL/phpMyAdmin/Drupal releases and everything went flawlessly thanks to this tutorial:
http://kahthong.com/book/2008/09/23/how-to-install-drupal-on-a-windows-p...
Now the last thing that I want to set up before I start creating my content is setting up multiple directories (for multiple sites) on a different drive (other than C:/). I am totally new to Drupal and the whole WAMP thing, but by now I realized that the Apache server has this htdocs directory where I put my Drupal/phpMyAdmin installations.
Now, is there a way I can move that whole directory to my desired drive and folder and still refer to it via localhost? How and which files should I configure, so that I can call my drupal sites via folder.localhost, instead of localhost/folder? I just don't want to run into linking problems when I upload my site to a live server due to poor referencing.
During the installation of MySQL 5.0 one of the things that I had to set up was "the directory where the InnoDB tablespace should be placed". I still don't know what this tablespace is all about, but I chose the directory where I intend to store all my sites and data (d:/web). Did I do the right thing? What I noticed however, was that when I created a database for Drupal before installing Drupal, MySQL stored it in its Program Files/data folder. Is this something I can change (i.e. change the default database directory) and should I worry about it when I move all my htdocs/drupal files to my d:/web?
I have already installed Drupal in the default Apache/htdocs folder. I guess there will be no problem with the installation itself, should I decide to move the whole folder, is there?
Thanks
Comments
Well, I made some successful
Well, I made some successful steps, finally. I figured out that in order to change the directory from where Apache serves pages I had to change the DocumentRoot lines in Apache's config file (in my case, from Apache's htdocs default to "d:/web".) I reinstalled MySQL 5.0 and set up a new database for Drupal. The only thing left for me is installing Drupal again and figuring out how I can create multiple sites under the same installation while still being able to call them separately via localhost.
About multiple sites... The
About multiple sites...
The server part: You can create named virtual hosts in Apache's httpd.conf, all of them going to drupal, like this:
(I assumed that drupal is in D:\web\drupal. Change accordingly).
Then restart Apache.
The Windows part: Edit your Windows hosts file (C:\Windows\system32\drivers\etc\hosts) with a text editor to tell Windows to resolve these domain names to your own machine:
The Drupal part: To be able to distinguish between the different sites, drupal needs properly named subdirectories under its /sites directory, containing fresh unconfigured copies of settings.php.
The exact names matter. Now, just browsing to one of the sites should start Drupal's installer, which will ask for the database information of that site.
In other words:
Full story at 11:00...
I was going to copy cog.rustys summary over there, because it was nice and concise. But I went looking and found it was already well documented. Twice :-/
If you think those pages could be made any clearer (I think they probably may) Please have a look.
.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Heh, sometimes I tell myself
Heh, sometimes I tell myself that I need to stop repeating things like that. But there are some topics that a thorough explanation is so long-winded that you can easily lose track of what you wanted to do while reading them.
Probably this habit of mine has to do with my personal difficulty to follow instructions without having a general understanding of what they are trying to achieve with those steps.
Thanks for the pointers
Thanks for the pointers guys, they really helped me learn some important principles of how Drupal works. But now I realize that I don't need to use Drupal's multi-site, since I probably won't be uploading my other sites to the same hosts. Most likely I won't be doing any other site the same way I did the previous, so now I don't see the point in going through the multi-site hassle (although I did all the aforementioned steps, just to understand that I just didn't need all this).
Now I have one Drupal installation in d:/web/drupal
For any other site that I'll do I'll simply create a new folder in d:/web and install another Drupal there. :)
The last thing I am concerned about is how my Drupal sites will be addressed. Right now I have to type http://localhost/drupal in order to reach the Drupal installation. Since I know that working in a subfolder might cause linking problems when uploading the site to a live server, is this way of addressing my drupal installations something that I have to worry about? Is it OK to call a Drupal installation from localhost/subdirectory? Am I going to experience any problems when I upload the site to my live host? If this is going to be a problem, how can I fix that? Should I reference the folder to subfolder.localhost, instead of localhost/folder?
Thanks a lot again!
P.S. I know that pasting the Drupal installation into the main localhost (d:/web) folder will solve these potential problems, but I don't want to do it this way because I'd like to be able to create new sites with new installations in new subfolders.
Yes, accessing the site with
Yes, accessing the site with a subdirectory URL will cause some problems to the file or image paths when you move the site (although not too hard to fix), *if* you intend to use clean URLs.
So, it good to use a subdomain-like URL by adding a vhost going straight to the proper directory.
If you won't use clean URLs, neither in the local nor in the real site, there is no problem, because then it is possible to use relative file paths.
Rusty, I have to use Clean
Rusty, I have to use Clean URLs and believe me I went through a lot of pain to understand how to set up the Apache server properly in order to enable this function. I edited my httpd-vhosts.conf file and created a virtualhost for my localhost directory and another one for my drupal subfolder. Thanks to this guide,
http://drupal.org/node/287963
I also edited the Windows's hosts file successfully and now I believe everything is perfect. I can now address my localhost via http://localhost/ and my Drupal installation via http://drupal/
I hope this way I won't encounter broken links when I upload my site to a server. :)
That is fine. Just remember
That is fine.
Just remember that because of the clean URLs you must use absolute paths in any file links in the content, with a front slash like
<img src="/files/images/filename.jpg" .... This way, when you view an image onnode/35the browser will retrieve correctly http://example.com/files/images/filename.jpg from the files directory, and not http://example.com/node/35/files/images/filename.jpg relative to the current path.This would be the problem if one of the sites was using a subdirectory URL, because then you would need to include the subdirectory in the absolute path, which would break the links when moving the site.
Gotcha. That made a lot of
Gotcha. That made a lot of sense to me. I know about linking problems because of some experiences from the past when I used to create static websites. That's why I always keep this in mind. I am new to Drupal, but relative and absolute paths make sense to me, and I will carry that useful advice with me.
Nice day!
For cases that it is hard to
For cases that it is hard to explain to the users how to do it, there are helpful modules such as is http://drupal.org/project/pathologic
That was only about links manually entered in the content.
In menu items etc Drupal takes care of relative links. Well written modules and themes which generate paths also take care of it by appending a base_path() in front.