Serve Your Website from a Different Directory

Serve Your Website from a Different Directory

Many PHP frameworks require you to serve your website from a custom directory.

The information here is for those running an Apache2 webserver running on Debian

Navigate to apache2 sites-available directory and locate the config file for your website

			
				

$ cd /etc/apache2/sites-available/yourwebsite.conf

Open the config file for your website and change the address in the DocumentRoot directive. Make sure you do this in the VirtualHost ip:80 and ip:443

			
				

        #
        #  The document root
        #
        DocumentRoot /www/path/to/the/new/root/directory

Finally run

			
				

$ sudo service apache2 reload