【问题标题】:Why have to re-install the existing wordpress after deployed on heroku为什么必须在部署到 heroku 后重新安装现有的 wordpress
【发布时间】:2016-09-11 02:35:42
【问题描述】:

我有一个现有的 WordPress 网站,可以在本地和在线服务器上正常运行。我只想将我的网站移动到 Heroku。 我已经按照 this 教程部署到 Heroku。

但是,当我访问 myappname.herokuapp.com 时,它要求我重新安装 WordPress。我该如何解决这个问题?

我删除了/wp-admin/import.php/wp-admin/install.php/wp-admin/install-helper.php/wp-admin/upgrade.php/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

【问题讨论】:

    标签: php wordpress .htaccess heroku


    【解决方案1】:

    第一次部署到 Heroku 时,您的数据库将是空白的,这与本地安装的数据库或您使用的其他在线服务器上的数据库不同。因为 Heroku 数据库是空白的,WordPress 会要求您再次执行安装。

    我建议如下:

    1. 从头开始再次执行部署。
    2. 不要不要像您已经删除的那样删除任何文件。
      a) 按照安装步骤进行

      b)或将现有数据库导入 heroku 数据库(超出此答案的范围)

    【讨论】:

      猜你喜欢
      • 2015-08-01
      • 1970-01-01
      • 2014-08-08
      • 2015-04-02
      • 1970-01-01
      • 2019-10-13
      • 2015-12-13
      • 2021-09-10
      • 1970-01-01
      相关资源
      最近更新 更多