Family Encyclopedia >> Electronics

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

As experienced WordPress professionals who've set up hundreds of multisite installations, we recommend installing WordPress in a subdirectory when you want to run multiple sites under one domain without impacting your main site. This approach leverages your root domain's authority for better SEO performance.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Subdomain vs. Subdirectory: Which is Better for SEO?

Typically, you start with a primary domain like wpbeginner.com. To add more sites, choose between a subdomain (newebsite.example.com) or subdirectory (example.com/newwebsite/).

Search engines view subdomains as separate sites, limiting their SEO benefits. Subdirectories, however, inherit the root domain's authority, often ranking higher—a key insight from our years optimizing client sites.

For managed networks, WordPress Multisite is ideal. For independent sites, separate installations work best. Here's how to install in a subdirectory.

Step 1: Create a Subdirectory in Your Root Folder

First, create a folder under your root directory (/public_html/) via FTP or cPanel File Manager. This holds your WordPress files.

Right-click and select 'Create New Directory.' Choose a name carefully—it becomes part of your URL (e.g., example.com/travel-guides/).

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Step 2: Upload WordPress Files

Download the latest WordPress from WordPress.org.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Extract the ZIP (double-click on Mac; 'Extract All' on Windows). Upload all files from the 'wordpress' folder to your subdirectory via FTP.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Step 3: Create a New Database

WordPress needs its own database. In cPanel, go to 'MySQL Databases.'

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Create a database name and click 'Create Database.'

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Add a MySQL user with a strong password.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Add the user to the database and grant 'All Privileges.'

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Step 4: Run the WordPress Installation

Visit example.com/your-subdirectory/. Select language and continue.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Enter database details (name, username, password, host: localhost).

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Confirm connection success.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Run setup, add site title, admin credentials.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Complete installation.

How to Install WordPress in a Subdirectory: Expert Step-by-Step Guide

Log in to your new site.

Step 5: Fix Permalinks (If Root Has WordPress)

A root WordPress install may cause .htaccess conflicts, leading to 404s. Edit the subdirectory's .htaccess:

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

Replace 'your-subdirectory' with your folder name.

This guide, tested across providers like Bluehost and SiteGround, ensures a smooth setup. For more, check our beginner WordPress SEO guide. Subscribe to our YouTube channel, follow on Twitter and Facebook.