Change Websites Default Folder to Another Folder in Apache
Apache is the most used server. It is used to serve more than half of all active websites. It will be very helpful to understand Apache. Understanding the configuration of virtual host of Apache is important as sometime it will be a tough job to do. I will show you how to set default folder of a website other than root directory of Apache.
I assume you have your default apache directory is in /var/www/ and you want to change that for a certain website.
Normally you will have to use folders inside /var/www/ to get successful result but it will be nice to keep the site in other folder like /home/domain.com/
<VirtualHost *:80> DocumentRoot /home/domain.com/ ServerName domain.com ServerAlias www.domain.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/home/domain.com/"> Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted </Directory> </VirtualHost>
Above configuration will do the work. If it works or doesn’t work please let me know by leaving comment. Thank you.