Keep WordPress in Another Directory with your own index.php file


Recently, I had to set up a WordPress site for a client, and they wanted to keep WordPress’ files in a seperate directory, but still have people see everything in the root of the site like they normally would..

So you’d go to and see the site, but all the WordPress files are actually in the wp/ folder, your visitors just wouldn’t know it..

First, I installed WordPress in a folder called wp/

Then in the root of the site, I created two files, the first was index.php:

    define('WP_USE_THEMES', true);

That’s it, nothing fancy, those two lines tell WordPress to start up.

Then I created a .htaccess file and added the usual mod_rewrite rules:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


Now, whenever someone goes to the site, they see WordPress, but we can also have other files in the same root area that don’t access WordPress and don’t cause interference.

Filed Under: Code

Roger Stringer spends most of his time solving problems for people, and otherwise occupying himself with being a dad, cooking, speaking, learning, writing, reading, and the overall pursuit of life. He lives in Penticton, BC.

Connect: Twitter |  Google+
This content is supported by readers like you.