I am running drupal using apache on redhat linux. Currently drupal is running at the root of the apache site. However, I want to put drupal in a sub-directory/virtual folder, because it's possible other sites will be on this server in the future.

The sub-folder I want to use is /fr. I can easily setup apache to use this alias, but how do I configure drupal to know that it's running in a subfolder? I currently have URLs like /agent/dashboard. If I configure apache for the /fr subfolder, drupal loads but it doesn't recognize /fr/agent/dashboard.

Do I just make a subfolder in the drupal install folder? I'm not too familiar with apache so I really don't know. Do I have to redefine all my routes (i'm using Drupal 8). I really hope not. I'm looking just for a setting in drupal or apache where I can set this.


1 Answer 1


Running Drupal in a subdomain and changing the document root of Apache virtual server are two different things.

To change document root you would set new paths in two Apache configuration lines for the given website:

DocumentRoot /home/username/public_html
<Directory /home/username/public_html>

Change the above two records to whatever you like, for example to:

DocumentRoot /home/username/public_html/sub-directory/sub-sub-directory
<Directory /home/username/public_html/sub-directory/sub-sub-directory>

and it wouldn't matter for Drupal as long as the following directive stays same:

ServerName example.com

In other words, whatever document root you set for a website, it will be still accessible through its domain name typed in the browser's address bar, set as ServerName in Apache configuration file, and Drupal will behave accordingly.

However, if you want to just place Drupal in a sub-directory, then you do not have to meddle with Apache configuration at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.