I have a multisite installation running in a sub-directory on the server - purely for the reason that it has become my MO to develop a new site for a client in a "WordPress" directory while their old site is live, and then when it is ready, I change the index.php and .htaccess files and voila, the site is live.

For the first time I have a multisite (sub-directory not sub-domain) in its own folder (not in the root) and now the process is different to what I was used to.

I have googled extensively and found info on the modifications to the .htaccess file - but I get "Error establishing a database connection" error when trying to access the root on my browser. Root.com/wordpress/ still works perfectly.

I've amended the .htacccess file with this code - as per WordPress.org:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress

And I've added the name of the subdirectory into the index.php file as per making a single site live - but now the establishing connection with the database error.

Could you please help with the next step - I sense I am close!

2 Answers 2


That's an error with your database credentials, as stored in wp-config.php . Check/fix those credentials to let WP access the database. (As the googles would tell you if you searched on the error message....)

  • Thank you Rick - I am not au fait with with working with WP's guts and i was too scared to change the wp-config.php file without knowing exactly what i was doing. The Googles did not give me the answer but your answer gave me the courage to make a change and it did the trick - answer below. Thank you!
    – Carin
    Aug 29, 2017 at 6:52

After i was assured that the problem was indeed in the wp-config.php file and nowhere else, all i had to was change, under the /* Multisite */ section:

define('DOMAIN_CURRENT_SITE', 'root.com');


define('DOMAIN_CURRENT_SITE', 'root.com/wordpress');

et voila!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.