WordPress within specific sub-directories, implicitly not root

I have an existing application running at my website root now. Using .htaccess, would it be possible for a single WordPress installation to manage sub-directories? For example, /press/, /careers/, /blog/ would be served by WordPress. The problem is I don’t want WordPress to get served on the root. I suspect something tricky with permalinks and .htaccess.

Option 2 for us here is building a CRUD into our app, but we really wanted to use WordPress (for certain pages).

3 Answers
3

Try this:

Rename your index.php (inside WordPress root folder) to index_.php or wordpress_index.php or whatever. This way you can load your current application, not the WordPress index. After that, open .htaccess in an editor and change it from something like this:

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

to this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wordpress_index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress_index.php [L]
</IfModule>
# END WordPress

Where it says index.php change it to the new name of the index file. This way, all other pages and permalinks will work, but your index will be your old application.

note:
user35541’s solution is good, but every time you want to add another page, you’ll have to once again add it manually to .htaccess. Plus if user35541’s statement that editing core files is bad was right, there would be no plugins for WP (which is virtually editing core files indirectly). The only problem in editing core files directly is that they will be overwritten if you update, but since you’re renaming a file (or creating a new one you if you will) it would not be affected.

Leave a Comment