URL rewrites & Drupal functions 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!
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.