How to Install Joomla in a Subdirectory

Joomla is one of the most popular Content Management Systems on the internet. As of August 2019, it controls almost 5% of the CMS market – which translates to roughly 2.5 million websites using Joomla. It boasts over 6,000 extensions (or plugins) in its repository that extend its functionalities. This tutorial will teach you how to install Joomla in a subdirectory of your web host instead of its root directory.

If you follow the steps below, remember to use the actual domain name of your website and the name of your Joomla installation folder instead of the words and subdirectory, respectively.

1. Install Joomla in a subdirectory

Refer to this tutorial to install Joomla using a piece of software called Softaculous.

2. Modify the configuration.php file

Open the configuration.php file and look for the following line:

public $live_site = '';

Set its value to your domain name like in the example below:

public $live_site = '';
3. Update the paths for the tmp and log folders (if moving site)

This step is for those who want to move their Joomla installation into a subdirectory. If you are installing Joomla, skip this step.

Look for the following lines in the configuration.php file:

public $log_path = '/home/carrotpark/public_html/administrator/logs';
public $tmp_path = '/home/carrotpark/public_html/tmp';

The folder paths may look different in your case. Change the paths to the ones below:

public $log_path = '/home/carrotpark/public_html/subdirectory/administrator/logs';
public $tmp_path = '/home/carrotpark/public_html/subdirectory/tmp';
4. Create a .htaccess file in the root directory

Create a .htaccess file in the root directory of your web host and write in it the following bits of code:

# Installed Site In Subdirectory
RewriteEngine on
RewriteCond %{THE_REQUEST} subdirectory/
RewriteRule ^subdirectory/(.*)$1 [R=301,L]
RewriteCond %{REQUEST_URI} !subdirectory/
RewriteRule ^(.*)$ /subdirectory/$1 [L]
5. Modify the subdirectory .htaccess file

Look for the file htaccess.txt in the Joomla installation subdirectory and rename it to .htaccess (with a dot before it). Open the .htaccess file and write the line below in it:

# Installed Site In Subdirectory
RewriteBase /subdirectory/
6. Logging in to the site

You can log in as Administrator to your Joomla-powered website at