I cant change my web root in apache, for some reason it points to /Sites/folder1/folder2 instead of it pointing to /Sites.
I configured and change my apache
there is a documentroot property in the /etc/apache2/httpd.conf on osx. so we can easily change the path like this;
DocumentRoot "{YOUR_ROOT_PATH}"
I came across the similar question as you, the httpd.conf under /private/etc/apache2/
defines the DocumentRoot as /Library/Webserver/Documents
. But that directory doesn't work!
Instead,the DocumentRoot which actually works is /usr/htdocs
! Weird!
Apache has several files with the same name httpd.conf
The "oficial" path is in /usr/local/etc/httpd/httpd.conf
I just meet this problem, too. I need to change the DocumentRoot and point it to my customised directory, which used for saving image files.
Berkay is right, you need edit a bit on your apache httpd.config file, but besides that, you need to do one more change, otherwise the WebSharing won't be able to turn on again.
Open your httpd.config by your favorite editor (Probably need to do this if you haven't change the permission access to this file)
Find DocumentRoot "/Library/WebServer/Documents"
, and change it to DocumentRoot "/Users/leiwang/Sites"
or any other folders you want to.
One important thing is, you need to give the Read/Write permission to the folder you specified.
Hope it helps:)
I ran into this problem: Once you change the root of web server to somewhere other than the default (/Library/WebServer/Documents), you need setup virtual host, otherwise, localhost will not work, and you will get:
403 Forbidden
error
You can refer to this link for details on how to set it up:
http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-10-yosemite/
Also make sure the following line is in the configuration file for the web directory if your Max is running OS X 10.10:
Require all granted
For your reference, I just remind you if this ever happens to you.
I went to /etc/apache/users/saad.conf and added the virtual host in this form "www.x.dev" to the top of my virtual hosts list. this temporarily fixed the problem. hope this helps