Apache Folder Configuration
You can make a change your default document root
folder in Apache by modify the Apache's configuration file.
/usr/local/etc/apache2/2.4/httpd.conf
For simplicity we'll use the built-in TextEditor application to make all our edits.
You can launch this from the Terminal by using the open -e
command followed by the path to the file:
$ open -e /usr/local/etc/apache2/2.4/httpd.conf
Search for the term DocumentRoot
, and you should see the following line:
DocumentRoot "/usr/local/var/www/htdocs"
Change this to point to your user directory where your_user
is the name of your user account:
In that same block you will find an
AllowOverride
setting, this should be changed as follows:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
Also we should now enable mod_rewrite
which is commented out by default. Search for mod_rewrite.so
and uncomment the line by removing the leading #
:
LoadModule rewrite_module libexec/mod_rewrite.so