[XAMPP for Mac] Change htdocs directory

In this short tutorial you will learn how to set up XAMPP Apache Server to serve a different htdocs folder and how to solve the “Access Denied!” error when doing so.

Open XAMPP, stop Apache and click on “Configure”
Click “Open Conf File” and confirm with “Yes”
Search for “DocumentRoot” and replace the lines “DocumentRoot” and “<Directory …” with your new htdocs folder:
Start Apache and try to open the page in your browser: Does it work? If you get a “Access Denied!” message, follow step 5.
If you get a “Access Denied!” message, you can eather:
Change the file permissions for your new htdocs folder so that the “deamon” user(-group) can read and write to it
Change the user with which httpd gets started
Stop Apache again
In the configuration file that opened up in step 2 search for “User”
Replace the user with a user that has read and write access to the folder, e.g. your username (The “internal” username that macOS uses (“John Smith” => “johnsmith”)) and comment out the “Group deamon” line with a “#”
Start Apache again

You should now have a working XAMPP Apache server with your new htdocs folder.