Okay I've googled this for hours...I installed wordpress to a subdirectory as a content management system, but I want my main index.php along with other files to remain in the root.

What .htaccess code do I need to so that the main url http://foo.com/index.php doesn't look for the wordpress/index.php (which of course causes the error "Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/..."

  • Are you trying to call wordpress functions from your index.php? If you have the content of wordpress installed in your subdirectory then foo.com/index.php shouldn't be returning an error. Sep 2, 2012 at 23:33

1 Answer 1


WordPress core in a subdirectory, but accessed via the root folder

If you're trying to move WP to a subdirectory, but access it from the root, use the following approach.

Keep your index file in the root, but point it to the proper path: ./SUBDIRECTORY/wp-blog-header.php instead of ./wp-blog-header.php

Make sure you change you change the home and siteurl settings to match your directory structure either in Settings->General or by adding the following to your wp-config.php file:


WordPress completely isolated to a subdirectory

If you would like to keep WP completely in the subdirectory, just move your .htaccess index.php files to the sub instead of the root. As long as it doesn't conflict with the root .htaccess, it should work just fine. You can have nested .htaccess files within subdirectories and permalinks should work just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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