Skip to Main Content

When and how to install WordPress in a subdirectory

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

Would you like to know when and how to install WordPress in a subdirectory?

When you manage multiple WordPress websites on the same web server, keeping some organization between installations is absolutely necessary, especially if you are managing customer projects. Or maybe because you do not want to install WordPress at the root of your hosting.

Discover How to manage WordPress files and folders

Whatever the case, the implementation of WordPress in a subdirectory is a solution that will help you organize.

In this tutorial we will explore two scenarios: When you first install WordPress and run the installer in a subdirectory, and when you need to move an existing installation from your website root directory to a subfolder.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

For both scenarios, WordPress allows you to display your website as if it were installed at the root of the domain.

Remark The following examples have been tested on an Apache web server, as recommended by Check that the module " mod_rewrite Is activated and you understand the file permissions.

Subdomain vs Subdirectory? Which one is better for SEO?

Normally, you want to start a WordPress website on its own domain name (eg However, sometimes you may want to create additional websites on the same domain name.

This can be done either by installing WordPress in a subdomain ( or in a subdirectory (

The question we are usually asked is which of these two options is better for SEO?

Search engines treat subdomains differently from root domain names and assign them rankings as a separate website.

On the other hand, subdirectories directly benefit from the authority of the root domain, thus ranking higher in most cases.

Another way to create separate WordPress websites in the subdomain or subdirectory is install the WordPress multisite network.

However, if you want to keep two websites managed separately, you can install different instances of WordPress. You can also use the WordPress website management tools to set up a single dashboard for managing your multiple WordPress installations.

Requirements for installing WordPress in a subdirectory

There are no special requirements to install WordPress in a subdirectory. If you already have a WordPress website, then you are good to go.

All the best WordPress hosting companies make it easy to set up multiple WordPress websites on the same hosting account.

For example, if you use Bluehost, you can add a new WordPress website from your hosting dashboard.

However, please keep in mind that most shared hosting accounts have limited server resources. A sudden spike in traffic to one of your websites will affect the performance and speed of all other websites on the same account.

If you are a beginner then you can do this on shared hosting. Keeping in mind that you will need to upgrade to managed WordPress hosting as your business grows.

That being said, let's take a look at how to easily install WordPress in a subdirectory.

Installing WordPress in a subdirectory

Download the most recent version of WordPress and install it in a subfolder of your choice on your web server. If you need help installing WordPress, check out our tutorial on installing WordPress.

Once after installing WordPress, go to " Settings> Permalinks »Adjust your structure permalinks. This will generate a .htaccess file, a configuration file at the level of the directory used, for problems accessing the website, such as the redirection and URL shortening.

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

Sometimes WordPress doesn't automatically generate or update the .htaccess file. In this case, you need to check if WordPress write access. You can read the file permissions of WordPress in the WordPress Codex. 644 settings are recommended

Now in " Settings> General " in the dashboard of your WordPress websites and search the WordPress address field (URL) and the address of the website (URL). The WordPress address is the address of the folder where you installed WordPress, and the website address is the URL of your website.

Both addresses should always include " http://And never have the final slash. By default, these fields have the same value.

In our example, we installed WordPress in the “wp-install” directory.

Table WordPress phpMyAdmin

Then, remove the part " / wp_install »Of the website address (URL), so that:

  • WordPress address (URL) either
  • Website address (URL) either

When and how to install WordPress in a subdirectory - General WordPress settings

Save the settings you just changed, but don't refresh your website yet.

Now, using your Preferred FTP client (FileZilla for example), connect to your website and copy the "index.php" and ".htaccess" files from your WordPress folder ("/ Wp_install" in this example) and paste them at the root of the domain (these files should always be together in the directory you define in the website address field, which is the root in our example).

Copy and paste these files, do not just move them to your WordPress directory.

If the "..htaccess »Is not visible, it could be because it does not actually exist (then the "prettylink" are not activated) or because your FTP client does not display hidden files.

This can also happen if you are working from a local environment and that your computer recognizes the .htaccess file as a system file and cache. Whatever the reason, you can force your FTP client to show hidden files.

Discover our 10 WordPress plugins to create sliders on a blog

Open the index.php file in the root directory of your domain in a text editor and replace the following line of code:

require (dirname (__FILE__) '/wp-blog-header.php.');

by this line

require (dirname (__FILE__) '/wp_install/wp-blog-header.php.');

That's all you need to do. Now your website will be served from the root directory of your web server.

When moving from WordPress to a root directory

If you decide to move an existing WordPress website from the root of the domain to a subfolder, a full backup of your website is absolutely necessary because the following steps involve updating the tables in your database.

See also How to Move a WordPress Blog with Duplicator

If something goes wrong while moving files and updating tables, it is better to be safe than sorry.  So think about making backups.

Then, using your favorite FTP client, create a new folder on your web server, " / wp_install Or whatever you want.

Then you have to log in to the dashboard of your website and go to the " Settings> General And edit the URL values. Set the WordPress address to the newly created folder and the website address should point to the root directory. You can use the values ​​we used earlier.

Example moving WordPress to subfolder

Then, to return to your FTP client, move the entire WordPress to the folder created instead, taking care to leave the files " index.php "And"..htaccess ". Then open the file "index.php" and replace the following line:

require (dirname (__FILE__) '/wp-blog-header.php.');

By this line

require (dirname (__FILE__) '/wp_install/wp-blog-header.php.');

With these changes in place, WordPress will search for the "wp-blog-header.php" file from its new location.

Now navigate to the following address: " "(by replacing "" with your domain name, of course) and log in to the dashboard of your website. Navigate to the following location Settings> Permalinks And change the structure of your favorite permalinks.

Note that you may need to save the permalink parameters, even if you do not make any changes to the permalink structure.

Discover our 10 practices to put together to boost your traffic on WordPress

Finally, it's time to examine the internal links in your navigation menus and the content of pages and articles. You can easily change the menu links, but doing it for existing articles will be a bit more complicated.

You can replace every occurrence of the old URL by running a query from your database, or better yet, you can use a plugin to run the same query.

Create and manage events on your website or blog by viewing the 10 premium WordPress plugins designed for this task.

With the Better Search Replace plugin, you can easily search and replace channels on WordPress. Just go to the location " Tools> Better Search Replace On the dashboard, after installing and activating the plugin.

Better Search Replace WordPress Plugin

From this interface, you can define the value to replace, as in the previous image. And if everything doesn't work out as it should, you can still restore your backup.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern look and optimize the grip of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. Super Social Content Locker

Super Social Content Locker is an all-in-one plugin, with social content locking functionality for your blog. In particular, it allows you to lock your content and customize the unlocking mode your visitors will use.Super social content locker wordpress plugins lock website content

Thus, to unlock content, users will for example follow you or share the content of the website on social networks, or watch your video advertising. They may also be asked to fill in a form, or simply to participate in a vote.

Read also our article on 8 WordPress plugins to easily create your layouts

This plugin can be used in two ways: on a widget lateral bar stand-alone or anywhere on the website.

Download | Demo | Web hosting

2. Five-Star Ratings & Reviews

From blog comments to e-commerce sites, the WordPress Five-Star Ratings & Reviews plugin allows users to rate and rate any type of content.

Five star ratings reviews wordpress plugins collect user reviews

This plugin offers as functionalities: user voting based on IP address, perfect integration with e-Commerce websites, post custom type support, and more

Download | Demo | Web hosting

3. Quick Edit Pro for WordPress

This WordPress plugin was developed to make your blogging and editing your content easier. quick-edit-pro-for-wordpress

In particular, it allows you to modify: your featured images, your article / page extracts, your publication formats, support for shortcodes and others.

Quick Edit Pro allows you to do all of this without leaving the comfort of the main screen of your posts / pages.

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.


Here ! That's it for this tutorial, I hope you now know when and how to install WordPress in a subdirectory. Do not hesitate to share with your friends on your favorite social networks

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

And if you have any suggestions or remarks, leave them in our section Comments.


This article features 4 comments

  1. the article seems interesting, but I have to look elsewhere because the unwanted and blocking ads are really painful.
    too much advertising

  2. Hello and thank you ! For this article and many others that I come to read regularly.

    I plan to follow the method of installing wordpress in a subdirectory that you explain, but I would like to be sure that it is the right way.

    I have to redo the site of an association that shares the domain name with their linguistic counterpart. The site is currently not under wordpress.

    Main site:
    Site to redo:

    Can I install the wordpress site in the / vb subdirectory without it getting stuck with the site hosted at the root?
    Who redirects from the old site to the new site (httpS, some page changes, etc.) - are they managed from the WordPress installation in the subdirectory?

    Sorry for those questions and thanks in advance for your feedback, if you have the chance!

    1. Hello,

      Yes you can install without problem. The most important is the WordPress directory, the rest works without worry.

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top