Alejandro Contreras
Alejandro Contreras

Reputation: 1

WordPress directs me to another page on localhost

I have installed Moodle 3.4 first, then I installed WordPress. I installed MySQL and PHP and followed the corresponding steps. Login to localhost / WordPress to continue configuring WordPress but it sent me to the Moodle page. The following is the file config.php of Moodle:

var/www/html/moodle/config.php  

Its content:

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'user';
$CFG->dbpass    = 'pass';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_unicode_ci',
);

$CFG->wwwroot   = 'http://localhost';
$CFG->dataroot  = '/var/www/html/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(__DIR__ . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!

The installation of WordPress is in:

var/www/html/wordpress

This is the only thing I have modified in the file wp-config.php. Just changing my data.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_asesorias');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'pass');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');


/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

URL in browser

Something must be generating conflict but I do not know what it is.

Upvotes: 0

Views: 313

Answers (1)

dannielarriola
dannielarriola

Reputation: 94

It's because you $CFG->wwwroot moodle variable. Change this to 'localhost/moodle' if you webserver is pointing to /var/www/html. Alternatively, modify you hosts file (/etc/hosts for linux, c:\windows\system32\drivers\etc\hosts for windows) and set an alternative hostname to localhost, then change $CFG->wwwroot var with this value.

Upvotes: 1

Related Questions