I have an existing WordPress website that works fine locally and on an online server. I just want to move my website to Heroku.
I have deployed to Heroku by followling this tutorial.
But, when I access to myappname.herokuapp.com, it asks me to reinstall WordPress again. How do I fix this?
I deleted /wp-admin/import.php
, /wp-admin/install.php
, /wp-admin/install-helper.php
, /wp-admin/upgrade.php
, and /wp-admin/upgrade-functions.php
.
/wp-config.php:
/** This should point to the app directory */
define('WP_SITEURL', "http://" . $_SERVER["HTTP_HOST"]);
/** This is the URL your visitors will see */
define('WP_HOME', "http://" . $_SERVER["HTTP_HOST"]);
define( 'WP_CACHE', true );
define( 'WPLANG', 'vi_VI' );
$url = parse_url(getenv('DATABASE_URL') ? getenv('DATABASE_URL') : getenv('CLEARDB_DATABASE_URL'));
/** The name of the database for WordPress */
define('DB_NAME', trim($url['path'], '/'));
/** MySQL database username */
define('DB_USER', $url['user']);
/** MySQL database password */
define('DB_PASSWORD', $url['pass']);
/** MySQL hostname */
define('DB_HOST', $url['host']);
/** 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', '');
/.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
When Deploying to Heroku for the first time, your database will be blank, unlike the database that was locally installed or on the other online server you were using. Because the Heroku Database is blank, WordPress will ask you to perform the installation again.
I would suggest the following:
Do not delete any of the files like you have already done.
a) Follow the installation steps
b) Or import your existing Database into the heroku database (beyond the scope of this answer)