Book Image

Drupal 7 Cookbook

By : Dylan Spencer James
Book Image

Drupal 7 Cookbook

By: Dylan Spencer James

Overview of this book

<p>Drupal 7 is a modern Content Management System famed for its flexibility and power. Using Drupal you can easily create custom functionality that would otherwise have to be purchased in many of the other leading CMSs.<br /><br />"Drupal 7 Cookbook" is filled with recipes to help you to do more with Drupal and improve your skills. Chapters range from content creation, to theming, to managing your site. You will learn how to create your own content types and use them to create Views, Blocks, and Pages. This book will take you from novice to pro in just 12 chapters.<br /><br />In a wide variety of practical recipes, you will learn how to work with views and panels, how to provide translations for your content to create a multilingual site, and to integrate your site with social media. You can develop the Zen starter theme or learn how to create custom cross-browser compatible Drupal themes, including themes for mobile devices. The Drupal 7 Cookbook contains all of the means necessary to take your skills from those of a novice Drupal user to a proficient site builder.</p>
Table of Contents (18 chapters)
Drupal 7 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Creating a multi-site Drupal installation


Drupal's multi-site feature allows multiple sites to run from the same core code, while having separate databases, configurations, and user files. Multi-site functionality removes the pain in managing multiple cores and multiple sets of modules, meaning that there is only one primary installation that needs to be updated and managed. It also reduces the amount of disk space that is required.

In this recipe, we will see how to prepare the secondary site's domain so that it points to the primary site's Drupal installation. We will then see how to activate and install the multi-site functionality on the primary site.

Getting ready

You will need the following:

  • An existing Drupal installation for your primary site

  • A domain name for your secondary site

  • The ability to update your secondary domain to point to the name server of your primary domain

  • You will need the ability to create an add-on domain for your primary site (we will see how to actually create the add-on domain in the recipe)

  • A blank database

How to do it...

  1. 1. Update your secondary domain's name server to be the same as the primary domain's name server.

  2. 2. On your primary server, log in to your server's admin panel and create a new add-on domain. Add the URL of the secondary domain as the new domain name.

  3. 3. Add a username and password. This is to enable you to provide specific FTP access to the secondary domain without providing FTP access for your primary domain. Set the document root to be the location on the server of your primary Drupal installation:

  4. 4. On your primary site create a new folder inside your sites directory which has the same name as your secondary site, for example, /Drupal root/sites/secondary-site.com/.

  5. 5. Copy default.settings.php from the following folder: /Drupal root/default/ to the /Drupal root/sites/secondary-site.com/ folder.

  6. 6. Rename the newly copied file to settings.php and set its permission to 666:

  7. 7. Under /Drupal root/sites/secondary-site.com/, create a new folder called files and set the folder permission to 777.

  8. 8. Go to your secondary site in your browser; you will see the standard installation screen.

  9. 9. Complete the installation wizard as described in the first recipe of this chapter (Installing Drupal). On the database settings page enter the login credentials of your newly created empty database.

  10. 10. After completing the installation, set the permissions of Drupal root/sites/secondary-site.com/settings.php to 444.

How it works...

Updating the name server is usually done through the domain registrar. The name server you need to enter for the secondary domain will most likely be provided by your hosting provider for your primary domain in the welcome e-mail. You may need to wait some time for the DNS records to propagate before your domain name resolves to the newly appointed server.

Creating an add-on domain allows you to set up a third-party domain to point to your hosting directory without having to redirect the user. This means that the URL in the address bar of the user's browser will remain constant, even though they are accessing the directory of another site. The setup procedure for configuring an add-on domain may be different with different hosting providers and control panels, and this example references the cPanel management panel. If you find difficulty getting this to work, reference your hosting provider's documentation for add-on domains.