MAMP – How to change the root directory on Apache Server

Before I start explaining on how we can change the root directory on Apache Server using MAMP, it’s important to remember that although MAMP was originally designed for Apple MAC systems, there is also a Windows version. I will be explaining how we can change the root directory on Apache server on both cases.

The examples below are for the standard versions of MAMP (free) and not the PRO versions (you have to pay after the trial period has expired).

If you don’t have MAMP yet you can get your free copy from http://www.mamp.info/en/.

 

MAMP on MAC (method 1)

  1. Open MAMP
  2. Select Preferences
  3. Select Apache
  4. You will be able to see the current location of your document root
  5. Click on the object next to the ‘Document Root:‘ text
  6. You will now have a new Finder window opened
  7. Select the new location for your document root and click on the ‘Select‘ button
  8. You have now setup the new document root location
  9. Select OK
  10. MAMP automatically stops and starts the Apache and MySQL servers

 

MAMP on MAC (method 2)

  1. Using Finder, select your HD device
  2. Go to Applications > MAMP > conf > apache
  3. Edit file  httpd.conf
  4. Do a find on ‘DocumentRoot’
  5. Replace the current path of your DocumentRoot (e.g.: /Applications/MAMP/htdocs) by your new (e.g.: /WebServers).
  6. Do another find on ‘DocumentRoot’ until you get to the line that says “This should be changed to whatever you set DocumentRoot to.
  7. Replace the path on DocumentRoot (e.g.: /Applications/MAMP/htdocs) by your new path (e.g.: /WebServers).
  8. Save the modified httpd.conf file
  9. Go to MAMP
  10. Select Stop Servers (if they are up and running)
  11. Once the Apache and MySQL servers are stopped, select Start Servers

 

MAMP on Windows (method 1)

In these instructions I will assume that you’ve installed MAMP on its default location (C:\MAMP). If this is not the case, then you should replace ‘C:\MAMP‘ in the instructions by your own MAMP location.

  1. Open MAMP
  2. Select Preferences
  3. Select Apache
  4. Click on ‘Select’
  5. Select where your new document root should be located
  6. Click on the ‘OK’ button
  7. Click on the ‘OK’ button
  8. MAMP automatically stops and starts the Apache and MySQL servers

 

MAMP on Windows (method 2)

  1. Using Windows Explorer, select drive C
  2. Go to C:\MAMP\conf\apache
  3. Edit file  httpd.conf
  4. Do a find on ‘DocumentRoot’
  5. Replace the current path of your DocumentRoot (e.g.: C:\MAMP\htdocs) by your new path (e.g.: C:\WebServers).
  6. Do another find on ‘DocumentRoot’ until you get to the line that says “This should be changed to whatever you set DocumentRoot to.
  7. Replace the path on DocumentRoot (e.g.: C:\MAMP\htdocs) by your new path (e.g.: C:\WebServers).
  8. Save the modified httpd.conf file
  9. Go to MAMP
  10. Select Stop Servers (if they are up and running)
  11. Once the Apache and MySQL servers are stopped, select Start Servers

 

3 Comments

  1. Thank you so much, I was wasting my head and time because I can’t set up any site on my localhost, and I have to start a wordpress course for my job. You literally helped me a lot. God bless you. PS. Excuse my English, Greetings from Colombia.

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.