Change XAMPP's htdocs web root folder to another one

Open /opt/lampp/etc/httpd.conf change nobody and nogroup

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nogroup
</IfModule>

to your username and your group


Had the same issue and here is what i did:

Run this command to stop xampp:

sudo /opt/lampp/lampp stop

Open /opt/lampp/etc/httpd.conf

Change your_folder to the folder you wanna use

 DocumentRoot "/home/username/your_folder"
 <Directory "/home/username/your_folder">

Change User & Group value from daemon to:

User nobody
Group nogroup

set chmod to your_folder with this command

sudo chmod 777 /home/username/your_folder

Save the file and start xampp with this command:

sudo /opt/lampp/lampp start

Open your browser and enter this url:

http://localhost/your_folder/

Done, hope this helps.