Page 1 of 1

Changing the directory

PostPosted: 04. January 2009 05:05
by Tedmund
I was reading that, XAMPP disables some features with apache and mysql. And that I'd have to do everything through XAMPP iteslf...

What I mean is, Can I change the directory to something else for my web content. I don't want to do everything strictly in \xampp\htdocs\. I'd like to use a separate folder on a different hard drive. Can someone tell me how to change the directory?

If not, do I have to use a seprate version of XAMPP?

Edit, also is there a way to change it to open a different link every time a use my ip. Because I'd rather a different location instead of http://***.***.***.***/xampp/splash.php

Re: Changing the directory

PostPosted: 04. January 2009 05:17
by Sharley
The simplest way is to use a Virtual Host by editing the xampp\apache\conf\extra\httpd-vhosts.conf file.

This will allow you to put your web site content in any location on your PC and also allows you to have multiple web sites served by the one server in XAMPP.

First do the hard yards by doing some reading:
Search the XAMPP For Windows forum for virtualhost or vhost.

Official Apache Documentation references:
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/examples.html

Re: Changing the directory

PostPosted: 04. January 2009 12:56
by berryboy
as for adding a dir try my thread: viewtopic.php?f=16&t=32593&p=132093#p132093

all that does is add my 2nd drive(E:) as http://xxxxxxxx/download2/

Re: Changing the directory

PostPosted: 04. January 2009 16:28
by dmphotography
Tedmund wrote:I was reading that, XAMPP disables some features with apache and mysql. And that I'd have to do everything through XAMPP iteslf...

What I mean is, Can I change the directory to something else for my web content. I don't want to do everything strictly in \xampp\htdocs\. I'd like to use a separate folder on a different hard drive. Can someone tell me how to change the directory?


If you're just tinkering or making one website on your webserver, then here's the way to do that:

Go to /xamp/apache/conf/ and open httpd.conf .
Search for DocumentRoot "C:/xampp/htdocs" (or whatever drive you installed XAMPP on)
Now change this to what you want your website directory to be. (example: "B:/mysite/")

Next, go down a few lines and find this:

<Directory "C:/xampp/htdocs">

and change it to what you want your website root folder to be.

Now simply save it and close it out. You should now reach your new directory when you go to "http://localhost/"

If you've configured your ports correctly through your firewall and router, your IP address should take you to this location as well. Be sure to have an index.php or index.html file in your new root directory, otherwise you'll get a page not found error or something similar.

Since you're reaching the splash page, this should work just fine for you.


Tedmund wrote:If not, do I have to use a seprate version of XAMPP?


NO!!! DO NOT tryt o install XAMPP twice to run another website on the same server. This will only cause problems. Trust me, I did it because I didn't understand it.

If you're wanting different websites on the same server, you will first need different domain names to access them publicly, otherwise you will always go to whatever your first [url]DocumentRoot[/url] is set to.

If you do want it and have a couple of domain names, use a service like http://www.ZoneEdit.com (it's free) and point the domain names to your IP address.

Then, do as Sharley said and follow those links on how to configure vhosts. You can have as many websites as you want on your server, assuming you have enough domain names and fast enough internet connection to support it.