WP-config.php : localhost and development and live site on in one file.


/ Published in: PHP
Save to your folder(s)

Source: http://www.websitedesignby.com/programming/wordpress-website-development-work-flow-wp-config-php/


Copy this code and paste it in your HTML
  1. if($_SERVER['HTTP_HOST']==’livedomain.com’ || $_SERVER['HTTP_HOST']==’www.livedomain.com’){
  2. define(‘DB_NAME’, ‘db_name_live’); // The name of the database
  3. define(‘DB_USER’, ‘mysql_username_live’); // Your MySQL username
  4. define(‘DB_PASSWORD’, ‘mysql_password_live’); // …and password
  5. define(‘DB_HOST’, ‘localhost’); // db host
  6. define(‘DB_CHARSET’, ‘utf8′);
  7. define(‘DB_COLLATE’, ”);
  8. define(‘AUTH_KEY’, ‘put your unique phrase here’);
  9. define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
  10. define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
  11. define(‘LIVE’, true);
  12. }else{
  13. define(‘DB_NAME’, ‘name_of_db_local’); // The name of the database
  14. define(‘DB_USER’, ‘mysql_username_local’); // Your MySQL username
  15. define(‘DB_PASSWORD’, ‘mysql_password_local’); // …and password
  16. define(‘DB_HOST’, ‘localhost’); // db host
  17. define(‘DB_CHARSET’, ‘utf8′);
  18. define(‘DB_COLLATE’, ”);
  19. define(‘AUTH_KEY’, ‘put your unique phrase here’);
  20. define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
  21. define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
  22. define(‘LIVE’, false);
  23. }
  24.  
  25. // You can have multiple installations in one database if you give each a unique prefix
  26. $table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!
  27. // Change this to localize WordPress. A corresponding MO file for the
  28. // chosen language must be installed to wp-content/languages.
  29. // For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
  30. // to enable German language support.
  31. define (‘WPLANG’, ”);
  32. /* That’s all, stop editing! Happy blogging. */
  33. if ( !defined(‘ABSPATH’) )
  34. define(‘ABSPATH’, dirname(__FILE__) . ‘/’);
  35. require_once(ABSPATH . ‘wp-settings.php’);

URL: http://www.websitedesignby.com/programming/wordpress-website-development-work-flow-wp-config-php/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.