how to change xampp htdocs directory in OSX?
Solution 1
solved by editing httpd.conf
I have got this working. As per http://www.acwolf.com/blog/2009/February/xampp-virtual-hosts-mac, in OSX it is necessary to make two changes to httpd.conf, first, uncomment
#Include /Applications/xampp/etc/extra/httpd-vhosts.conf
and second, change the user from nobody to the username you use to log into OSX. You may also need to delete your browser's cache.
Solution 2
Open the following file in a text editor.
/Applications/XAMPP/xamppfiles/etc/httpd.conf
Search for "DocumentRoot", if the line below has a #
in front of it than it's commented remove it and change the path between the quote
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
Now search for the line below and change the path between the quotes to your needs.
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
NOTICE: Paths similar to ~/
won't work use the absolute path.
Solution 3
Other than the answers mentioned above, I also had to change the line in XAMPP/xampfiles/etc/httpd.conf
where it mentions username. the default was set to daemon
and I changed it to my username; so there was no permission problem.
Solution 4
If you forward to a directory in your user root, then:
DocumentRoot "/Users/<your username here>/Sites"
<Directory "/Users/<your username here>/Sites">
Related videos on Youtube
jela
Updated on January 21, 2022Comments
-
jela over 2 years
I want to change XAMPP's htdocs directory. I followed the instructions to create a virtual host from this question:
Make XAMPP/Apache serve file outside of htdocs
this works fine on Windows 7, however when I try it on OSX, going to mysite.local just loads the xampp splash screen (mysite.local/xampp/index.html). I have restarted the web server. My virtual host declared in httpd-vhosts.conf is:
<VirtualHost *:80> DocumentRoot Users/username/Documents/sitename.com ServerName sitename.localhost <Directory Users/username/Documents/sitename.com> Order allow,deny Allow from all </Directory>
-
Arturo Molina about 11 yearsThe link provided does not seem to work anymore. I found an another article describing the process and also mentions that you need to edit your computer's hosts file: f6design.com/journal/2012/03/11/…
-
poitroae almost 11 yearsWhere did you change the user? @jela
-
Gianluca Ghettini over 10 yearswhere did you change the user?
-
Robin F. about 7 yearssearch for "User deamon" and change it to your username - most likely you can get your username it with the whoami command
-
-
Primoz Rome about 11 yearsIf you only change these two setting it won't work. I am trying to change document root my self, but without success for now. Followed above edit, but didn't work for me either.
-
risnandar over 10 yearsi can solve that problem with this answer. You also have to uncomment the first line to make it work. Mine is using XAMPP Osx 1.8.2-2
-
Mahmoud Fayez over 10 yearsYou will lose the phpMyAdmin in that case !
-
Daniel Harris over 10 yearsMake sure that your new root folder exists because if it doesn't, Apache won't start.
-
SumNeuron about 7 yearsIm using MacOS Sierra and this causes an Access Forbidden thing to show...
-
Robin F. about 7 years@SumNeuron search for the "User deamon" within your httpd.conf and change it to your os user. you can get the os user with help of the whoami command. (I guess you figured that out by now but I hope it helps others)
-
Harish Kumar almost 4 yearsuse this to make it work. replace user name - stackoverflow.com/a/32963665/2444716