Title: Subfolder install &#8211; Root folder index.php gets overwritten occasionally
Last modified: August 22, 2016

---

# Subfolder install – Root folder index.php gets overwritten occasionally

 *  [trixxd](https://wordpress.org/support/users/trixxd/)
 * (@trixxd)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/subfolder-install-root-folder-indexphp-gets-overwritten-occasionally/)
 * Hi all,
 * I have a site that was **installed in a subfolder** some time ago that on 2 occasions(
   months apart), the following error message was displayed in the browser when 
   visiting the domain name.
 * > There doesn’t seem to be a wp-config.php file. I need this before we can get
   > started. Need more help? We got it. You can create a wp-config.php file through
   > a web interface, but this doesn’t work for all server setups. The safest way
   > is to manually create the file.
 * The site had not been touched (apart from fixing this issue).
 * On both occassions that this has happened, it seems to have been caused by the
   root folder’s index.php file getting overwritten.
 * The index.php file should include the following edited code:
 *     ```
       /** Loads the WordPress Environment and Template */
       require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
       ```
   
 * But each time the missing wp-config.php issue has occurred, it reverts back to:
 *     ```
       /** Loads the WordPress Environment and Template */
       require( dirname( __FILE__ ) . '/wp-blog-header.php' );
       ```
   
 * Manually changing this index.php file to include edited code again fixes the 
   problem…but it seems to only be a temporary solution, as something keeps causing
   it to revert back every few months.
 * **Questions**
    1. Does anyone know what is causing this index.php file to revert back to its default?
    2. Is there a way I can permanently fix this issue?
 * Thanks for the help!

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

 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/subfolder-install-root-folder-indexphp-gets-overwritten-occasionally/#post-5512108)
 * > 2. Is there a way I can permanently fix this issue?
 * AITpro at BulletProof Security suggests these permissions settings and I keep
   mine right there at all times unless *I* am the one doing the editing or changing:
 *     ```
       .htaccess	../.htaccess	404	0404
       wp-config.php	../wp-config.php	400	0400
       index.php	../index.php	400	0400
       wp-blog-header.php	../wp-blog-header.php	400	0400
       ```
   
 * I occasionally have a plugin complain during a trial, and I summarily dismiss
   that plugin right after that. Have a look at this:
 * > …We will never be responsible for toasting your WordPress site because we introduce
   > a bug and destroy your .htaccess. Too many plugins are hitting these file, 
   > we found, and it more-often-than-not breaks websites because the variables 
   > involved are too numerous to count. The last thing we want is a broken .htaccess
   > party – the worst kind of party.
   >  [https://www.icontrolwp.com/2014/05/wordpress-security-wordpress-simple-firewall-plugin-part-1-why/?utm_source=in-plugin&utm_medium=plugin-readme&utm_content=wordpress.org&utm_campaign=WordPress%20Simple%20Firewall%20Plugin](https://www.icontrolwp.com/2014/05/wordpress-security-wordpress-simple-firewall-plugin-part-1-why/?utm_source=in-plugin&utm_medium=plugin-readme&utm_content=wordpress.org&utm_campaign=WordPress%20Simple%20Firewall%20Plugin)
 *  Thread Starter [trixxd](https://wordpress.org/support/users/trixxd/)
 * (@trixxd)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/subfolder-install-root-folder-indexphp-gets-overwritten-occasionally/#post-5512264)
 * Ok, I will look into changing the file permissions and see if that solves it.
 * Would still be nice to know what’s causing it though…
 * Could WordPress be automatically updating itself in the root folder? Would that
   overwrite the index.php file?
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/subfolder-install-root-folder-indexphp-gets-overwritten-occasionally/#post-5512332)
 * > Could WordPress be automatically updating itself in the root folder?
 * If you have not taken specific action to disable automatic WordPress updates,
   then yes, it updates any or all targeted wp-folders and wp-files at the time 
   of an automatic update. If you want complete control over that (such as to possibly
   have only plugins update automatically), maybe have a look at this plugin:
 * [https://wordpress.org/plugins/search.php?q=WordPress+Simple+Firewall](https://wordpress.org/plugins/search.php?q=WordPress+Simple+Firewall)
 * > Would that overwrite the index.php file?
 * I am not certain there, but I tend to think not.
 *  [tmarsh1](https://wordpress.org/support/users/tmarsh1/)
 * (@tmarsh1)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/subfolder-install-root-folder-indexphp-gets-overwritten-occasionally/#post-5512518)
 * I think that the auto update of WP is certainly what causes the root folder index.
   php to be overwritten, killing the pointer to the sub folder.
 * Keeps happening to me.
 * Will turn auto updates off and see.
 * Those permissions settings leejosepho, is that in WP Simple FW plugin you link
   to?

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

The topic ‘Subfolder install – Root folder index.php gets overwritten occasionally’
is closed to new replies.

## Tags

 * [index.php](https://wordpress.org/support/topic-tag/index-php/)
 * [subdirectory](https://wordpress.org/support/topic-tag/subdirectory/)
 * [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/)
 * 4 replies
 * 3 participants
 * Last reply from: [tmarsh1](https://wordpress.org/support/users/tmarsh1/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/subfolder-install-root-folder-indexphp-gets-overwritten-occasionally/#post-5512518)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
