Title: WordPress installation in a subfolder
Last modified: August 30, 2016

---

# WordPress installation in a subfolder

 *  [ceekayel](https://wordpress.org/support/users/ceekayel/)
 * (@ceekayel)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/wordpress-installation-in-a-subfolder/)
 * I have wordpress in a subfolder, called wp, and have Composer operating whereby
   all themes and plugins are located in the root folder wp-content (instead of 
   in the wordpress installation folder).
 * In order for Duplicator to find all my site’s files I had to modify my wp-config.
   php and three files in the duplicator plugin.
 * /** Absolute path to the base installation directory, given this
    installation
   is in wp subfolder. */ in wp-config.php I add:
 * $wp_subfolder = “wp”;
    if ( !defined(‘ROOTPATH’) ) define(‘ROOTPATH’, str_replace(‘
   wp’, ”, dirname(__FILE__)));
 * and this as .htaccess to allow for redirects to the wordpress php files
    and 
   such (I made these modifications in duplicator class.config.php around line 61)…
 * # BEGIN WordPress
    <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule
   ^index.php$ – [L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME}-
   d RewriteRule ^ – [L] RewriteRule ^(wp-(admin|includes|snapshots).*) ${wp_subfolder}/
   $1 [L] RewriteRule ^(.*\.php)$ ${wp_subfolder}/$1 [L] RewriteRule . index.php[
   L] # .htaccess Fix for 403 Error Infinite Loops RewriteEngine On RewriteCond %{
   ENV:REDIRECT_STATUS} 403 RewriteRule .* – [L] SetEnvIf Origin “^http(s)?://(.
   +.)?([http://stage.mysite.co](http://stage.mysite.co)|mysite.com)$” origin_is
   =$0 Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
   Header always set Access-Control-Allow-Credentials true </IfModule> # END WordPress
 * in duplicator package.php
    – $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH,‘/’);
   + if ( !defined(‘ROOTPATH’) ) + { + $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH,‘/’);
   + } else { + $this->Archive->PackDir = rtrim(ROOTPATH, ‘/’); + }
 * and in package.archive.php
 * – $rootPath = DUP_Util::SafePath(rtrim(DUPLICATOR_WPROOTPATH, ‘//’ ));
    + if (!
   defined(‘ROOTPATH’) ) + { + $rootPath = DUP_Util::SafePath(rtrim(DUPLICATOR_WPROOTPATH,‘//’));
   + } else { + $rootPath = DUP_Util::SafePath(rtrim(ROOTPATH)); + }
 * [https://wordpress.org/plugins/duplicator/](https://wordpress.org/plugins/duplicator/)

The topic ‘WordPress installation in a subfolder’ is closed to new replies.

 * ![](https://ps.w.org/duplicator/assets/icon-256x256.png?rev=2906985)
 * [Duplicator - Backups & Migration Plugin - Cloud Backups, Scheduled Backups, & More](https://wordpress.org/plugins/duplicator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duplicator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duplicator/)
 * [Active Topics](https://wordpress.org/support/plugin/duplicator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duplicator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duplicator/reviews/)

## Tags

 * [subfolder](https://wordpress.org/support/topic-tag/subfolder/)

 * 0 replies
 * 1 participant
 * Last reply from: [ceekayel](https://wordpress.org/support/users/ceekayel/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/wordpress-installation-in-a-subfolder/)
 * Status: not resolved