Changing default Project Workspace in Apache

I have Eclipse and XAMPP installed in my Vista machine at the following locations.
C:\eclipse
C:\xampp 

So, by default, http://localhost/projectName points to C:\xampp\htdocs\projectName as per the installed location of xampp. That is what I want to change to something like F:\gaurav-goel\workspace\projectName.

I wanted to keep all the project files at a central place and be able to view them at http://localhost/projectName for different PHP projects with Flex. This would also help keep all the projects' files at a central location irrespective of whether it is PHP or Flex. That can be handy for backup purpose. 

Here is all I had to do. I made below two changes in C:\xampp\apache\conf\httpd.conf

  1. Comment the default Document Root.
    #DocumentRoot "/xampp/htdocs"
    Change the document root to where you want to keep all your files. For example DocumentRoot "F:\gaurav-goel\workspace"

    Then I stopped and started XAMPP again to get the above settings working. When I tried to access my project at http://localhost/projectName it gave me 'Access Forbidden' error message. So, I changed below tag in C:\xampp\apache\conf\httpd.conf.
     

  2. Modify the line <Directory "/xampp/htdocs"> to <Directory "F:\gaurav-goel\workspace">. All other code inside <Directory "/xampp/htdocs"></Directory> remains untouched.

Hope, this would help someone attempting to change the root web location to some other place instead of htdocs.

 

Post new comment