As an experienced webmaster of over 15 years, I‘ve helped hundreds of users install WordPress in subdirectories.
It opens up many possibilities, but can also cause headaches if you don‘t do it right.
In this ultimate guide, I‘ll share step-by-step how to properly set up WordPress in a sub-folder.
I‘ll provide tips to avoid headaches down the road based on best practices I‘ve learned over the years.
By the end, you‘ll have the confidence to create multiple thriving WordPress sites under one domain.
Contents
Why Use Subdirectories for WordPress?
WordPress powers over 40% of all websites as of 2022. The flexibility of WordPress has made it the world‘s most popular CMS.
Installing WordPress in a subdirectory allows you to:
-
Run multiple sites from one domain: For example, have your blog at
yourdomain.com/blog
and an ecommerce store atyourdomain.com/store
. -
Segment content and sites: Keep different sites separate while still benefiting from the domain authority.
-
Test changes: Create a staging site at
yourdomain.com/staging
to test design changes safely. -
Save money: No need to pay for additional domains and hosting. Use subdirectories.
-
Improve SEO: Subdirectories inherit SEO value from the root domain which helps rankings.
According to Google analytics data, around 34% of sites use WordPress. The flexibility of WordPress is a key reason for its widespread popularity.
Now let‘s get you set up with WordPress installed in a subdirectory the proper way.
Choosing the Right Domain and Host
Before we install WordPress, you need to select the right domain name and web host for your website.
Here are tips on how to choose your domain and hosting:
Pick a Domain Name
Your domain is your website‘s address on the web. Here are some tips for choosing one:
- Make it short, memorable, and easy to spell
- Use keywords relevant to your industry or content
- Consider using your brand name in the domain
- Check availability by searching on domain registrars
- Avoid hyphens and numbers in the domain name
- Pick a
.com
extension for global visibility
Some good domain name examples: blogcadre.com, copyblogger.com, problogger.com
Find the Right Hosting
Your web host stores your site files and delivers them to visitors. Here‘s what to look for in a good host:
- Fast performance – Use hosts with solid-state storage for faster speeds.
- WordPress optimized – Choose hosts that auto-install and configure WordPress.
- Reliable uptime – Look for hosts with 99%+ uptime guarantees.
- Good support – Pick hosts with 24/7 customer support via phone/chat.
- Automatic backups – Choose hosts that backup your site regularly.
I recommend using managed WordPress hosts like Bluehost, SiteGround, or WPX Hosting for best results.
Step 1 – Create the Subdirectory
Once you have your domain and web hosting, it‘s time to create the subdirectory.
-
Log in to your web host using an FTP client like FileZilla.
-
Navigate to the
public_html
orwww
folder. This is usually the root. -
Right click and create a new folder. Name it something relevant like
blog
orstore
. -
The name you pick will be part of the URL, like
yourdomain.com/blog
.
This new folder will house your WordPress installation files.
Pro Tip: Whenever creating a new site, always use a subdirectory over a subdomain if possible. Subdirectories inherit 100% of the root domain‘s SEO value versus subdomains which start from scratch.
Step 2 – Upload the WordPress Files
Now that you have created the directory, it‘s time to upload WordPress into it.
-
Download the latest WordPress ZIP file from WordPress.org.
-
Extract the ZIP file which contains the
wordpress
folder. -
Upload the
wordpress
folder to your newly created subdirectory. -
Alternatively, you can use Softaculous or Installatron in your hosting control panel to install WordPress with just a few clicks.
Be sure to select the subdirectory you created as the installation directory when using auto-installers.
Step 3 – Create a New Database
Now we need to make a new database for this additional WordPress site.
-
Log in to your hosting control panel and navigate to Databases > MySQL Databases
-
Click on "Create New Database". Give it a name relevant to your site like
yourdomain_blog
. -
Go to Users and create a new database user account. Select a secure password.
-
Give this new user full privileges to your newly created database.
Your new WordPress site in the subdirectory needs its own database to store all the site contents. Make sure to note the new database name, user, and password.
Step 4 – Run the WordPress Installer
Time to install WordPress!
-
In your browser, visit
yourdomain.com/blog
to open your WordPress directory. -
On the setup screen, select your language and click continue.
-
Enter your new database name, user, password, and database host. The host is usually
localhost
. -
Click Submit to connect to the database.
-
Once connected, run the installer. Enter your desired Site Title, Admin Username, Password, and Email.
-
Click install. The setup wizard will now install WordPress for you.
The process usually takes less than 3 minutes. Once done, your site is ready to use.
Tip: Make your Admin Username and Password very secure. Avoid simple passwords even on staging sites to prevent security risks.
Step 5 – Configure Permalinks
Since your subdirectory WordPress site shares a domain with the main site, we need to set up permalinks properly to avoid conflicts.
-
Login to your new site‘s admin at
yourdomain.com/blog/wp-admin
. -
Go to Settings > Permalinks.
-
Change it to "Post Name" instead of default and click Save.
-
This will make WordPress append the subfolder name to URLs instead of the parent domain‘s folder.
You may still get some 404 errors due to .htaccess
conflicts between both sites.
To fix it, open the .htaccess
in the /blog/
folder and add:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
Replace /blog/
with your actual subdirectory name. This resolves permalink issues.
Extra Tips and Best Practices
To avoid headaches down the road, here are some tips:
-
Use separate credentials for each site even if they are under one account. Don‘t share credentials.
-
Update both sites regularly to maintain security and prevent conflicts.
-
Limit plugins to essential ones on subdomain sites to avoid performance issues.
-
Monitor resource usage as sites grow in size and traffic. Upgrade hosting plans if needed.
-
Enable CDNs to speed up subdomain sites by serving static assets from nearby servers.
-
Cache dynamic content using a compatible WordPress caching plugin to boost performance.
-
Use SFTP instead of FTP for better security when managing your WordPress sites and files.
-
Take regular backups of the database and files to avoid losing any data.
Conclusion
I hope you found this guide useful for learning how to properly install WordPress in subdirectories.
While the steps may seem complex at first, it gets easier with practice.
The benefits of running multiple WordPress sites under one domain are tremendous.
You can create segmented sites for different needs, test changes safely, and improve your SEO.
Let me know if you have any questions! I‘m always happy to help WordPress users.