• Alessandro Di Ruscio

    (@thirdeyeblind82)


    Hi guys!
    I’m working on my website on my computer and sometimes I upload changes and database online just to check the result.

    Everytime I upload the database online, I have to change manually some values like “siteurl” and “home” inside the wp-option table!

    Do I have to do this change everytime or there is an easier way?

Viewing 4 replies - 1 through 4 (of 4 total)
  • govpatel

    (@govpatel)

    when you use database locally and then online the urls change and you could change them in settings general before you export database locally and change them back.

    Thread Starter Alessandro Di Ruscio

    (@thirdeyeblind82)

    Anyway, I should change these settings everytime I move the website, is that right?

    govpatel

    (@govpatel)

    yes there no other way as you changing from localhost to online server.

    frederic_giroux

    (@frederic_giroux)

    In fact there is a way ! In your wp-config.php, replace these lines ( 19 – 28 ) :

    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘wp-premierTemplate’);

    /** MySQL database username */
    define(‘DB_USER’, ‘root’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ”);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    By these lines :

    $local = false;
    if ( stristr($_SERVER[‘HTTP_HOST’], ‘local’) ||
    substr($_SERVER[‘HTTP_HOST’], 0, 7) == ‘192.168’)
    {
    $local = true;
    }

    // Sélectionne les informations de connexion à la BD
    // selon l’environnement d’exécution
    if ($local)
    {
    define(‘DB_NAME’, ‘your_bd_name’); /** The name of the database for WordPress */
    define(‘DB_USER’, ‘root’); /** MySQL database username */
    define(‘DB_PASSWORD’, ”); /** MySQL database password */
    define(‘DB_HOST’, ‘localhost’); /** MySQL hostname */
    }
    else
    {
    $bd_server = ‘your_server’;
    $bd_username = ‘your_username’;
    $bd_password = ‘your_password’;
    $bd_name = ‘your_bd_name’;
    }

    This will check out if you are in local or not !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Modify the database’ is closed to new replies.