Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to isolate a wordpress installation on our site to a specific subfolder. I created a folder on our root site named _wp and placed all the wordpress files in there. I added the following rewrite rules to the htaccess in our root folder to allow permalinks within the wordpress installation to work properly.

# Wordpress
RewriteBase /_wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /_wp/index.php [L]

This allowed permalinks within the subfolder to work, but it is also allowing requests for files outside the _wp folder to forward to the wordpress site. For example, the following page on my wordpress site:

http://www.mysite.com/_wp/mypage

can also be accessed by the following URL:

http://www.mysite.com/mypage

I don't want this to happen. I want to isolate all access to the wordpress site by requiring the _wp prefix. Does anybody know how I would modify the htaccess above to allow this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

If you want your WP site to function completely in subfolder, just set it up there as usual (including .htaccess) and do not add any directives to the root.

Setup of .htaccess in root, while WP is in subfolder, is only necessary if you want to have core files (and so admin area) there, but have site itself be root-based. As per Giving WordPress Its Own Directory instructions in Codex.

share|improve this answer
    
Thanks, it was as easy as that! I just placed the above .htaccess rules in the _wp folder, instead of the root. –  flashk Oct 10 '12 at 16:11
add comment

Your Answer

 
discard

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.