0

I have a server that hosts our Drupal 7 development, testing, and production environments:

  • /var/www/html/dev
  • /var/www/html/test
  • /var/www/html/prod

Instead of having dev and test live in subdirectories like http://ourdomain.edu/dev, we want the URLs to be http://dev.ourdomain.edu.

From a Drupal standpoint, is this best accomplished through an .htaccess file in each directory? Or in settings.php?

At the moment, functions like path_to_theme() aren't working at http://ourdomain.edu/dev since path_to_theme begins with a forward slash. Consequently, the theme refers to http://ourdomain.edu/sites/all/themes/ourtheme/images/logo.png instead of http://ourdomain.edu/dev/sites/all/themes/ourtheme/images/logo.png

It would be great to know what's considered best practice.

Thanks!

1
  • As @Thomas4019 siad, Drupal handles everything gracefully once you've got the server configured properly.
    – Beatrice
    Commented Dec 18, 2013 at 20:39

1 Answer 1

2

If you are running Drupal in subdirectory named "dev". Then you need to put $base_url = 'http://www.example.com' in your settings.php. You may need to put RewriteBase /dev in your .htaccess but generally that isn't necessary for me.

If you want to run Drupal at http://dev.example.com that is purely an issue of configuring Apache correctly. Your likely need to change your httpd.conf or similar file to setup virtual hosting. Drupal won't need any changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.