Once we installed XAMPP in C drive of a windows os computer , the default document root will be C:\xampp\htdocs
where we will store all our PHP projects in different folders, we run projects in the browser with corresponding folder names for example http://localhost/abcd. Say if you want to run the php project from any other folders in your computer or from an external storage media, you can achieve this by change httpd.conf file located inside C:\xampp\apache\conf folder.
Open this httpd.conf file in any text editor , and find this line from the file DocumentRoot “C:/xampp/htdocs” and change this “c:/xampp/htdocs” into the desired folder location, say you want change into “G:/localhost” . After that just below this line <Directory “C:/xampp/htdocs”> , change also this into desired folder say <Directory “G:/localhost”>. After this two changes save the file and restart Appache server. Then you can run from web browser your desired php project located in the folder.