Categories: Mac

AMMPS For Mac – Changing the Apache Document Root

I’ve tried a few testing servers over the years but now I have a Mac I decided to use Ampps for all of my development needs. Ampps, if you don’t already know is an alternative to Xampp, Mamp, Wamp and various other web servers. When installing a web server I like to move the document root outside of the default path to prevent me deleting it and also to keep it backed up so here is a little tutorial on how to change the Apache document root in Ammps.

Lets Get Started

First of all start Ammps and click on the Apache on the left of the menu. Click Configuration and the httpd.conf file will open up in your default text editor.

Finding your Document Root Path

Open finder in Mac and navigate to the folder you want to create your document root. For the purpose of this tutorial I will use the Documents Folder but some people may want to use a folder in Dropbox or a similar cloud storage device so that files are always backed up and synced over multiple platforms if needed.

As you can see in the image above I have added the folder www which will hold all of my files. If you see at the bottom you will see a path which starts with Macintosh HD -> Users -> Username -> Documents. Make a note of this and go back to the httpd.conf file which you opened earlier in this tutorial.

Look for the following:

DocumentRoot "{$path}/www"

and change it to display your own path like so

DocumentRoot "/Users/tracyridge/Documents/www"

Now we need to change one more setting in the same file.

Find the following line:

# This should be changed to whatever you set DocumentRoot to.
# ====================================================== # !!! DO NOT CHANGE THIS LINE AND THE FOLLOWING ONES !!! # ====================================================== <Directory "{$path}/www">

and change it to, you guessed it!

# This should be changed to whatever you set DocumentRoot to.
# ====================================================== # !!! DO NOT CHANGE THIS LINE AND THE FOLLOWING ONES !!! # ====================================================== <Directory "/Users/tracyridge/Documents/www">

Save the file and restart apache and from now on you can place all of your files in the new folder.

Conclusion

The same solution may also work for other web servers that use Apache including Windows variants. Just remember that Windows Servers use forward slashes

(/)

  instead of backslashes

()

  and you may also require to prefix the path with C:/

Share
Published by
Tracy Ridge
Tags: Server

Recent Posts

Hot New Web Dev – November 2024

Welcome to Hot Web Dev November 2024, featuring the latest technology and web development news.… Read More

3 weeks ago

Hot New Web Dev – October 2024

Welcome to Hot Web Dev October 2024, featuring the latest technology and web development news.… Read More

2 months ago

New Svelte 5 Guessing Game 2024

In this tutorial, you’ll build a fun and interactive guessing game using Svelte 5, the… Read More

3 months ago

Hot New Web Dev – September 2024

Welcome to Hot Web Dev September 2024, featuring the latest technology and web development news.… Read More

3 months ago

New JavaScript Guessing Game 2024

The JavaScript guessing game tutorial is a simple beginner's project. It features modern JavaScript syntax… Read More

3 months ago

Hot Web Dev – 12 Useful Top Tools of 2023

If you have been following the monthly Hot Web Dev magazine you will find the… Read More

3 months ago