[ apache2 ] how to install mod_rewrite in ubuntu


/etc/apache2$ sudo a2enmod rewrite

will be in 


2. change ‘AllowOverride None’ to ‘AllowOverride All’

in /etc/apache2/sites-available/default

For example, 

<VirtualHost *:80>
  ServerAdmin webmaster@localhost

  DocumentRoot /var/www
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all

[ wordpress ] “Error establishing database connection” after migration

When we migrate the wordpress from one host to the others, one common error we got is “Error establishing database connection”.

The solution is

  • update ‘wp_options’ table by setting ‘siteurl’ row to the new URL. i.e.  ‘http://localhost/blog&#8217;.
  • update ‘wp_blogs’ table set the ‘domain’ column to the new URL. i.e. ‘localhost’

That’s it.


– The Preview theme does not show up :

The ‘wp_options’ table may have to be updated by setting ‘home’ row to the new URL, i.e.  ‘http://localhost/blog&#8217;. In order for the ‘get_option(‘home’)’ in ‘wp-includes/functions.php’ to get the right value.

– The rest of the path is at

  • wp-config.php
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/blog');
  • ‘wp_site’ table, ‘wp_sitemeta’ table
  • home row in ‘wp_options’ shows the home URL of all the link in the web