WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/..."

share|improve this question
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. – Pollux Khafra Sep 2 '12 at 23:33
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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