403 Error after adding a new website directory

On an ubuntu server it is common to host site files in a directory with a structure like ‘/var/www/example.com’.

One might wish to separating a subdomain out from site files in another directory. Something like ‘/var/dev/example.com’.

How to fix or prevent a 403 error after adding a new site directory

To prevent a 403 error, remember to edit the /etc/apache2/apache2.conf file to allow this directory to be accessed from the outside world.

The /etc/apache2/apache2.conf file has a ‘Require all granted’ directive for the normal /var/www directory that looks like this:

Make a copy of this directory for the new directory that are creating and add it to the /etc/apache2/apache2.conf file.

Once you have updated this file, remember to restart apache.

Leave a Reply

Your email address will not be published. Required fields are marked *