Title: wp-config.php redirect from subfolder
Last modified: August 20, 2016

---

# wp-config.php redirect from subfolder

 *  Resolved [lightbourneinc](https://wordpress.org/support/users/lightbourneinc/)
 * (@lightbourneinc)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/)
 * Hello.
 * I’ve just gone live with our new build, url is: [http://lightbourne.com](http://lightbourne.com).
   I’ve installed WP in a subfolder (/live) I’m receiving errors with some php files
   looking for wp-config.php after making the site live and moving the config file
   to the root. Can I run a redirect function or recode the template php files affected?
   So far the shopping cart is the only issue I’ve found, but I can’t fully test
   until the cart php file is redirected to root where the wp-config.php is now.
 * This is the error received: Warning: require(/home/light123/public_html/live/
   wp-config.php) [function.require]: failed to open stream: No such file or directory
   in /home/light123/public_html/live/wp-content/themes/lightbourneinc/cart_handler.
   php on line 7
 * Fatal error: require() [function.require]: Failed opening required ’/home/light123/
   public_html/live/wp-config.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/
   php’) in /home/light123/public_html/live/wp-content/themes/lightbourneinc/cart_handler.
   php on line 7
 * I’ve been reviewing the forums but haven’t found the same issue with redirect
   to root from the subfolder.
 * Thanks for your time!
 * Best, Shannon
    Lightbourne, Inc.

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104491)
 * I think you need to review See [Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install).
 *  Thread Starter [lightbourneinc](https://wordpress.org/support/users/lightbourneinc/)
 * (@lightbourneinc)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104609)
 * Thanks for your help esmi. I’ve read your posts before and learned a lot from
   you already.
 * Yes, I moved the site correctly. Did it again this morning as a complete new 
   install/then import just in case. This time I first moved the wp.config.php on
   a clean WP install (checked that all was working in base themes), then imported
   child theme/content/xml files just in case that was the issue. Same result when
   I tried shopping cart. Everything else is a go and moved perfectly, but the shopping
   cart has conflict with the wp-config.php location in root. The php code in the
   file (cart_handler.php) codes path for wp-config.php to the wp install folder(
   line 7–see error message). I need to let the file know to go to the root folder
   to find wp-config.php. So, can I alter the .htaccess file in the wp subfolder
   to let the template files that need direct access to the wp-config.php to go 
   to root?
 * What do you think? Seems to me I just need to find a way to let the template 
   files know where to go . . .
 * Best, Shannon
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104611)
 * Why are you moving the wp-config.php file?
 *  Thread Starter [lightbourneinc](https://wordpress.org/support/users/lightbourneinc/)
 * (@lightbourneinc)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104613)
 * I thought I was following the directions for a subfolder build, the same process/
   steps I’ve read/used previously (then again with your link: Giving_WordPress_Its_Own_Directory).
   I haven’t had trouble before, but this is the first time I’ve child-themed this
   specific theme which includes a shopping cart function.
 * Am I reading the directions incorrectly at [Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Moving_a_Root_install_to_its_own_directory)?
 * Maybe I just do the install in the subdirectory and point the index.php to the
   subdirectory leaving the wp-config.php file in the subdirectory?
 * Thanks for your help.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104614)
 * You don’t move the wp-config.php file when configuring WP to take over the root
   domain from a sub-folder. I’d suggest that you move it back and review [Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install).
 *  Thread Starter [lightbourneinc](https://wordpress.org/support/users/lightbourneinc/)
 * (@lightbourneinc)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104615)
 * OK. Moved wp-config back into subfolder and all is well. Now I’m confused by 
   the directions I’ve used before. 🙂 What am I missing?
 *  Thread Starter [lightbourneinc](https://wordpress.org/support/users/lightbourneinc/)
 * (@lightbourneinc)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104616)
 * Got it. I guess I was making my install more complex than I needed to. I guess
   for a new install that has always been in the subfolder you just copy the .htaccess
   and the index.php . . . have I got it now?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104617)
 * Yep – you got it. 🙂
 *  Thread Starter [lightbourneinc](https://wordpress.org/support/users/lightbourneinc/)
 * (@lightbourneinc)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104631)
 * **Phew!** Shopping cart is working smoothly now.
    Thanks again for all your help!
 *  [sadhaka](https://wordpress.org/support/users/sadhaka/)
 * (@sadhaka)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104746)
 * If this is the case, then the guide at:
 * [http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
 * … is misleading, for it specifically instructs you to:
 * “Move (DON’T COPY) the wp-config.php file to your root directory.”

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

The topic ‘wp-config.php redirect from subfolder’ is closed to new replies.

## Tags

 * [redirect](https://wordpress.org/support/topic-tag/redirect/)
 * [subfolder](https://wordpress.org/support/topic-tag/subfolder/)
 * [wp-config.php](https://wordpress.org/support/topic-tag/wp-config-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 3 participants
 * Last reply from: [sadhaka](https://wordpress.org/support/users/sadhaka/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/wp-configphp-redirect-from-subfolder/#post-3104746)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
