Title: database connection error for multisite WP in separate folder
Last modified: January 4, 2017

---

# database connection error for multisite WP in separate folder

 *  [pic123](https://wordpress.org/support/users/pic123/)
 * (@pic123)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/database-connection-error-for-multisite-wp-in-separate-folder/)
 * I’ve been building a multisite WP network in its own folder on a server with 
   an existing HTML website. The software was installed by Softaculus. The idea 
   was that I just remove index.html and it cuts over to WP loveliness.
 * The WP sites work wonderfully if I access them as
 *  website.com/wordpress
 * but if I access them as
    website.com
 * then I get a **Database Connection error**.
 * The wp-config.php and index.php files are sym-linked into the root folder (to
   ensure they are the same) and .htaccess has +FollowSymLinks and all the WP rewrite
   rules are set as per what WP tells me:
 *     ```
       Options +FollowSymLinks
       Options -Indexes
   
       RewriteEngine On
       RewriteBase /wordpress/
       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]
       ```
   
 * I’m assuming the database credentials are fine and the database is not corrupt
   since with a particular URL everything works brilliantly.
 * I’ve spent ages trawling the codex and other web sites but none of the advice
   is doing it for me and much seems inconsistent:
 * ** I’ve tried adding the following to the wp-config.php
 *     ```
       define('WP_HOME','http://website.com');
       define('WP_SITEURL','http://website.com');
       ```
   
 * ** Many instructions talk about changing the address in the Settings/General 
   Site address (URL) but this doesn’t exist at network or site level.
 * I suspect some interaction between the URL rewrite rules and WP but I don’t understand
   it deeply enough to figure this out. Any help or tips appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [ancawonka](https://wordpress.org/support/users/ancawonka/)
 * (@ancawonka)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/database-connection-error-for-multisite-wp-in-separate-folder/#post-8619591)
 * I don’t think you can do this type of URL rewriting w/ WordPress Multisite in
   a subfolder. (I’m guessing you want your URL’s to be [http://website.com/site1/page](http://website.com/site1/page),
   rather than [http://website.com/wordpress/site1/page](http://website.com/wordpress/site1/page)).
 * You might have to move your install up one level, or set your domain’s root to
   the /wordpress directory so that you don’t have WordPress in a subdirectory.
 * Have you been able to determine what the actual connection error is?
 *  Thread Starter [pic123](https://wordpress.org/support/users/pic123/)
 * (@pic123)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/database-connection-error-for-multisite-wp-in-separate-folder/#post-8619697)
 * That’s a surprising limitation if true. But so far I haven’t even gotten to the
   second site, my problem is with the first site which should be functionally similar
   to a non-multisite setup right?
 * There are a lot of pages talking about this (never specifically for multisite)
   and the advice seems to be don’t move the code, do URL rewrites.
 * I enabled all the debug flags but no debug.log is produced, maybe the error happens
   too early in the processing?
 *  [ancawonka](https://wordpress.org/support/users/ancawonka/)
 * (@ancawonka)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/database-connection-error-for-multisite-wp-in-separate-folder/#post-8619739)
 * Well, once you turn on Multisite, there are a number of new things to consider,
   all related to rewriting URL’s. Multisite, if you have installed it as a subdirectory
   install, for example, will add /site1, /site2 to the URL’s for each subsite, 
   so this has to be made to work with the server-level rewrite from Apache.
 * I did a little more digging, and found this article that you might find helpful:
   [https://foliovision.com/2015/01/wpmu-in-subdirectory](https://foliovision.com/2015/01/wpmu-in-subdirectory)
 * Their scenario is a little bit different, since they were upgrading, and you’re
   starting new, but there is a lot of useful info there.
 *  Thread Starter [pic123](https://wordpress.org/support/users/pic123/)
 * (@pic123)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/database-connection-error-for-multisite-wp-in-separate-folder/#post-8632175)
 * Big thanks [@ancawonka](https://wordpress.org/support/users/ancawonka/), that
   worked fine. 3 small changes: 2 to the database and 1 to wp-config. In summary
   they are:
 * Database:
 * in wp_blogs database table, path should be set to
    /
 * in wp_site database table, path should be set to
    /
 * Constants in the main config file
 * in wp-config.php make sure there is
    define(‘PATH_CURRENT_SITE’, ‘/’); (instead
   of define(‘PATH_CURRENT_SITE’, ‘/wordpress/’); )
 * It’d be great if this info was in the codex (or if it is, make it easier to find)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘database connection error for multisite WP in separate folder’ is closed
to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [pic123](https://wordpress.org/support/users/pic123/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/database-connection-error-for-multisite-wp-in-separate-folder/#post-8632175)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
