Changing HTDOCS Name and Location

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Changing HTDOCS Name and Location

Postby dweiss » 19. April 2015 16:15

I would like to use Xampp to provide a test server for PHP and related web development components. My key issue is whether I can configure my portable Xampp installation in such a way that instead of having the HTDOCS directory within the Xampp file structure, I can instead make Xampp think that my HTDOCS is really a directory called WEBSITES, which in turn is a subdirectory of my main data directory on my Windows C: drive.

In other words, when I go to: http://localhost/xampp, I would like to be taken to the copy of the Xampp directory that now resides at: c:\data\websites\xampp. The purpose of all this is to facilitate the use of Xampp as a PHP test server for use with my Dreamweaver installation, which is already setup to work on various websites located at: c:\data\websites. Is there some way to modify my Xampp installation / configuration to accomplish the changes proposed.

I realize that I could move my websites to the HTDOCS directory on my portable Xampp installation, but I would prefer to keep my various hard drives and data files configured as they are and just modify my Xampp configuration to know where those files are located.

I would appreciate any assistance anyone can offer on this. Also, if this is a really bad idea for some reason, please feel free to say so! It all makes sense to me, but those of you with more experience and expertise might know better.

Thanks for whatever help you can provide,

Posts: 9
Joined: 06. February 2006 00:14
Location: Washington, DC

Re: Changing HTDOCS Name and Location

Postby Nobbie » 19. April 2015 17:28

dweiss wrote:Is there some way to modify my Xampp installation / configuration to accomplish the changes proposed.

Of course, this is standard configuration of Apache (keep in mind, there is no "Xampp" software, Xampp is only a distribution of different software tools). What you are looking for is the configuration of the "DocumentRoot" for Apache.

In your installation you will find a file called "httpd.conf" in the c:/xampp/apache/conf directory, there you will find a line "DocumentRoot ....", change it to your needs. BUT: per default, DocumentRoot yields to c:/xampp/htdocs, there are some more configuration lines for c:/xampp/htdocs (for configuring certain rights and options) in httpd.conf, you have to change the pathnames there as well. Restart Apache after changing configuration.

Finally you should read some tutorials about Apache configuration, you will need it anyway.
Posts: 9064
Joined: 09. March 2008 13:04

Re: Changing HTDOCS Name and Location

Postby WilliL » 20. April 2015 16:34

I wouldn't change htdocs - so local work is allways possible. I prefere to work with vhosts For each website an expicite vhost and document root.
In xampp you'll find the configuration file c:/xampp/apache/conf/extra/httpd_vhosts.conf (suggested installation folder)
The file hosts (c:/windows/system32/drivers/etc/hosts) should be edited too.
Posts: 661
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: Changing HTDOCS Name and Location

Postby iircmp » 20. April 2015 19:01

I think this might help you.

1. Go to C:\XAMPP_FOLDER\apache\conf
2. There should be a file called httpd.conf.
3. Open it with a text editor (recommended not to use the default Windows Notepad or Wordpad).
4. On line 191, you should have the code that says DocumentRoot "/XAMPP_FOLDER/htdocs"
5. On line 221, you should have the code that says <Directory "/XAMPP_FOLDER/htdocs">
6. Change that to your desired location and then save.
7. Quit out of the Xampp control panel and re-open it again. Turn on the Apache service and it should work.

The location should change to your directory you want however if you are trying to create multiple domains (not subdomains) on 1 machine, it will not work. I believe you are allowed to only have 1 localhost setting on your machine. The default localhost address is I don't think works at all.
Posts: 2
Joined: 19. April 2015 22:59
Operating System: Windows 7

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 74 guests