This guide is for proxying a WP Engine install through the subdirectory of another. If you want to serve a single WP Engine install as a subdirectory (without a second install), click here instead.

What’s this for?

You want to serve a complete WP Engine install through a subdirectory on another WP Engine install with your live domain (ie. /blog). You immediately run into a problem – you can only associate your domain with one WP Engine install at a time. You could manually install WordPress in a “physical” folder in the root of your site called /blog.

But alas, the main WordPress site will try to serve a page called “blog” (or whatever your folder name is), rather than serve the subdirectory. So you figure out a .htaccess or ngnix rule to allow it to serve.

Alas again! There can only be one database per WP Engine install so you’ll need to configure the new subdirectory WordPress with it’s own prefix, separate from the root one and merge both sets of tables. But that’s doable, with some elbow grease and large pot of coffee.


Alas again, again! The WP Engine daily backups won’t capture your subfolder as it sits outside the standard WordPress file path convention.

Avoid all that hassle, with a reverse proxy! We’ve even gone ahead and made a sweet generator to spin you up the copy/pastas you need. Massive shout out to Victor Jasso for his epic job on concocting this method.

What are we doing here?

To explain what we’re about to do here, let’s imagine we have two WP Engine installs. Your main domain is called which is paired to an install called

What you’re going to do is serve a second install, called through the subdirectory

We just need to do 3 things to instruct to pull content from when /blog is added to the end of

Make sense?

No worries if not. Just follow these 4 steps and it’ll make more sense once you see it.

Step 1: Stop WordPress from rewriting your .htaccess

Grab this PHP file, wpengine-stop-htaccess-rewrites.php, from Ryan Hoover’s Github and pop it in /wp-content/mu-plugins/ of the install you want to serve in the subdirectory (the equivalent of from the example above). Here’s the code in case it’s easier for you to do it manually:

 * Stop htaccess rewrites
 * @package     wpengine-stop-htaccess-rewrites
 * @author      wpengine
 * @license     Proprietary
 * @wordpress-muplugin
 * Plugin Name: Stop htaccess rewrites
 * Plugin URI:
 * Description: Stops Rewrite Flush from changing the htaccess file on proxy passed sites.
 * Version:     0.1.0
 * Author:      wpengine
 * Author URI:
 * Text Domain: wpengine-stop-htaccess-rewrites
 * License:     Proprietary
namespace WPEngine\StopHardRewrite;
	function() {
		// Get the PATH from the site url.
		$path = wp_parse_url( get_option( 'siteurl' ), PHP_URL_PATH );
		// If we have a path, then this is a proxy pass. Stop hard rewrites.
		if ( ! empty( $path ) && '/' !== $path ) {
			add_filter( 'flush_rewrite_rules_hard', '__return_false' );

Step 2: Generate your wp-config.php & nginx code

Next, we need to make some modifications to your wp-config.php and also to nginx. Ew! But don’t worry – here’s a generator to spin you up the code you need.

The generator

Just enter your domain name, subdirectory path and install name (of the second install, equivalent of in the example above) in the form and you can copy and paste!

Enter the live domain name of the primary site:

Enter the path you want to serve the second install under

Please include the leading slash, as below:

Enter the WP Engine install name of the second site you want to serve:

Step 3: Modify wp-config.php

Add the following lines to the bottom of your wp-config.php (just above the line that says # That's It. Pencils down)

Awaiting the generator...

Step 4: Modify nginx

Unfortunately, you don’t have access to modify the nginx configuration on your end, but that doesn’t mean a member of the WP Engine support team can’t help. Hop into their live chat and ask them to add this to the before-in-location nginx block.

Awaiting the generator...


This configuration is not actually supported by WP Engine – meaning you’re on your own if it goes wrong. So be safe and test it on a non-critical site first.

Elementor Page Builder

Related Articles

Copyright © 2019 Nodeflame

HOW TO: Setup a reverse proxy between 2 installs on WP Engine

by nodeflame time to read: 3 min