Table of Contents |
---|
Local Environment
Kalabox
If you are using Kalabox, you should have some basic conditionals that setup your settings.php to operate on Pantheon and your local Kalabox:
Code Block | ||||
---|---|---|---|---|
| ||||
/** * Terminatur * * These local settings were generated by terminatur. * You may see them if you use Kalastack, Kalabox, Proviso or other local dev * tools. * */ if (isset($_SERVER['KALABOX']) && $_SERVER['KALABOX'] === 'on') { // DB Array and some common conf. $databases['default']['default'] = array( 'driver' => 'mysql', 'database' => 'mysite_kala', 'username' => 'root', 'password' => 'password', 'host' => 'localhost', 'port' => '3306', 'prefix' => '', ); // Set some common desirable local vars. $conf['file_temporary_path'] = '/tmp'; $conf['file_public_path'] = 'sites/default/files'; $conf['file_private_path'] = 'sites/default/files/private'; $conf['reroute_email_enable'] = 1; $conf['cache'] = 0; $conf['css_gzip_compression'] = FALSE; $conf['js_gzip_compression'] = FALSE; $conf['preprocess_css'] = 0; $conf['preprocess_js'] = 0; $conf['site_name'] = 'mysite Local'; $conf['cron_last'] = '9999999999'; } |
Non-Kalabox
If you aren't on Kalabox, you should setup something similar. Make sure you don't overwrite any of the existing Kalabox settings or Pantheon configuration:
Code Block | ||||
---|---|---|---|---|
| ||||
if (isset($_SERVER['KALABOX']) && $_SERVER['KALABOX'] === 'on') { // Kalabox stuff from above would be here. } else { // Your custom local environment db configuration and the sane defaults // shown in the Kalabox config above should be here. } |
...
301 Redirect to Single Domain
On most sites that are going live, we'll want to make sure all requests are directed to a single domain for ideal SEO and user experience. We do this with a permanent 301 redirect:
Code Block | ||||
---|---|---|---|---|
| ||||
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) {
/**
* Redirect 404 config to the D6 site to hide D7 development
* REMOVE ME ON LAUNCH
*/
$conf['redrect_404_search'] = 'http://www.mysite.com/search/apachesolr_search';
$conf['redirect_404_redirect'] = 'http://www.mysite.com';
$conf['redirect_404_servers'] = 'http://www.mysite.com';
if($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') {
// settings for launching Featured Events
if($_SERVER['HTTP_HOST'] == 'live-mysite.gotpantheon.com' || $_SERVER['HTTP_HOST'] == 'www.mysite.com'){
header('HTTP/1.0 301 Moved Permanently');
header('Location: http://mysite.com'. $_SERVER['REQUEST_URI']);
exit();
}
}
} |
Full Settings.php Example
Here is an example portion of a settings.php with environmental magic on Pantheon
...