Title: Error establishing a database connection
Last modified: August 30, 2016

---

# Error establishing a database connection

 *  Resolved [Hadeelayyad](https://wordpress.org/support/users/hadeelayyad/)
 * (@hadeelayyad)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-725/)
 * hi there,
    my website with wordpress works well in sub folder in domain and i’m
   trying to redirect the main index.php url to this folder i tried this code <?
   php define(‘WP_USE_THEMES’, true);
 * /** Loads the WordPress Environment and Template */
 * require( dirname( __FILE__ ) . ‘/wp/wp-blog-header.php’ );
 * ?>
 * but the website is going to get this error
    “Error establishing a database connection”
 * my wordpress website works very well in mywebsite.org/wp
    and i need to let mywebsite.
   org to redirect to this folder /wp where to wordpress installed !!
 * any help well be appreciated
 * many thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [Hadeelayyad](https://wordpress.org/support/users/hadeelayyad/)
 * (@hadeelayyad)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-725/#post-6685249)
 * i tried this code and it works very well !
 * <?php ob_start();
    header(“Location: /wp/”);
 * thank you all

Viewing 1 replies (of 1 total)

The topic ‘Error establishing a database connection’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Hadeelayyad](https://wordpress.org/support/users/hadeelayyad/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-725/#post-6685249)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
