»  Knowledgebase  »  WordPress Administration  »  Installing WordPress in a Subdirectory

Installing WordPress in a Subdirectory

by | Mar 19, 2020 | 0 comments

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

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.


Submit a Comment

Your email address will not be published.

UK WordPress Support

We are a team of UK based WordPress experts offering WordPress help & support, WordPress site management and maintenance, content management services, one to one WordPress training and consultancy.

Need to chat? Contact Us Now!

WordPress Maintenance

Let us manage your plugin and theme updates, keep your WordPress website site running smoothly and your visitors happy!

WordPress Care Plans
from just £35 / month!

One to One WordPress Training

We provide one to one WordPress training to individuals and companies all over the World!

Whether you are developing new skills for business or working on a personal project, we can support you, and your first trial session is free!

Book an initial WordPress Orientation Session

Get the WordPress Management Guide

Get the WordPress Management Guide

Sign up to our newsletter to receive our insider guide to managing WordPress in [currentyear], free to your inbox.

You have Successfully Subscribed!