Chrooted Jails with very short filesystem paths

To give you some necessary background information on how WP Stagecoach works (or any other software that changes where a WordPress sites lives), it needs to do two things: first, it needs to change the URL for your site from your live “” to say “”, which is pretty easy to see.  Second, it needs to change something less obvious: the filesystem path – that is, where the files live on your live server, because they will live in a different location on the staging server. Typically these paths will look like /home/ or /var/www/example/staging-site/, which are unique and can be searched for in the database and replaced to the the staging site’s path when the plugin copying the site.

Some web host may set your website in what’s called a “chrooted jail” where it appears to reside at the very top of the filesystem – that is “/”, or very near the top, for example “/wp”.  The problem is that neither of those are unique within the database.  If your site lives under /wp, that is still not unique – for example, there are lots of entries within the database that include /wp that aren’t referencing the filesystem path: /wp-content/plugins/ and /wp-content/themes/ just to name a couple, and when you try to create the staging site, WP Stagecoach goes and finds all the entries that include “/wp” and replaces them with what the filesystem will be on the staging server, in this case: /var/www/example/staging-site
So all of a sudden, all references to “/wp-content/themes/” are now “/var/www/example/staging-site-content/themes/”, which as you can imagine, causes all kinds of chaos.

Related Articles