Need help? Book our fixed price WordPress Support service.

Installing WordPress in a Subdirectory

In some case, you may need to install WordPress in a subdirectory (eg /subdirectory/) but have it appear as though it’s in the root.

WordPress Settings

In Settings > General

  • WordPress Address: http://www.example.com/subdirectory
  • Site Address: http://www.example.com

Add .htaccess file to subdirectory

  • Place standard .htaccess file in the WordPress subdirectory and edit as follows:


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

Add Additional index.php to root directory

  • copy index.php from your WordPress installationa nd add to the root directory with the following changes (in bold)


define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/subdirectory/wp-blog-header.php' );

Don’t forget to remove index.html or other files that may be causing the site in the root directory to load. You may also need a WordPress .htaccess file in the root dir.

Was this article helpful?

No 0

About the Author

Christian Mayne is a full time WordPress developer and consultant based in the UK. He runs a UK based WordPress development agency with clients all over the World. As well as WordPress development, Christian has been teaching WordPress use and development since 2014 in classroom settings and online.

LEAVE COMMENT