This guide is for serving a single WP Engine install through a “subdirectory” (like /blog) without breaking backups and other functionality. If you want to serve a second install through the “subdirectory” of another install, click here instead.

What’s this for?

You have a requirement to serve a complete WordPress install through a subdirectory (ie. /blog) on WP Engine, perhaps the root domain is being served from another host, or you need to preserve the URL structure for SEO reasons.

Logically, you could manually install WordPress in a “physical” folder in the root of your site (ie. called /blog/) or just move the existing WordPress instance there – then you just need to tweak the .htaccess or add an ngnix rule to ensure WordPress knows to serve it from there.

The problem

The WP Engine daily backups won’t capture your subfolder if it sits outside the standard WordPress file path convention. So how do we do it in a way that ensures the backups will still run?


What we’re going to do is keep WordPress in the root of the install, and use some modifications to wp-config.php, .htaccess and nginx to rewrite the paths. Follow these 3 steps:

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

We need to make some modifications to your wp-config.php and also to nginx. Here’s a generator to spin you up the code you need to speed things along.

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 install:

Enter the "subdirectory" you want to use.

Please include the leading slash, as below:

Enter the WP Engine install name:

Step 2: 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 3: Modify nginx

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

Awaiting the generator...

Step 5: Modify .htaccess

In your root .htaccess, find the line RewriteBase / and make it look like this:

Awaiting the generator...

If you’re modifying the default .htaccess on WP Engine, it should look something like this:

HOW TO: Serve WordPress through a subdirectory on WP Engine

You’re now serving the entire install through a “subdirectory” and WP Engine backups will now complete like normal, as all the WordPress files are “physically” in the default root.


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: Serve WordPress through a subdirectory on WP Engine

by nodeflame time to read: 2 min