1

I am using Apache Friends (XAMPP). I installed it under C: drive. Its path is C:\xampp\
Its default root is C:\xampp\htdocs.Thus, all programs need to reside in C:\xampp\htdocs\ so that we can run http://localhost/myapp/

PhpMyAdmin comes along with XAMPP, but it resides in C:\xampp\ and it can be run from /localhost/phpMyAdmin/.
When my application is moved to C:\xampp\, I cannot run it /localhost/myapp.

I would like to have two server root C:\xampp\ and C:\xampp\htdocs\ so that I can separate my private apps and public apps in different folders. And both can be run from http://localhost/ such as /localhost/myprivateapp/ and /localhost/mypublicapp/

How can I do that ? I'm on Windows XP.

Sithu
  • 111
  • 4

2 Answers2

3

Basically you can do anything with XAMPP you could do with any other Apache installation. The first thing to know is that the Apache configuration files for a default XAMPP install are in c:\xampp\apache\conf and C:\xampp\apache\conf\extra

The default webroot is, as you mentioned, c:\xampp\htdocs as defined by the above configuration files, the phpMyAdmin directory is nothing more than a standard Apache alias which makes /phpMyAdmin look in "c:\xampp\phpmyadmin\" for its files.

You have several options, depending on what you mean by public vs private (I assume you might want to password protect the private files). You can use an alias, or you could even set up an entirely new vhost/server, I will post links to some documentation and a very basic example below.

The simplest way to accomplish what you want would be to create a folder in the c:\xampp root called "private" - "c:\xampp\private\" and edit the c:\xampp\apache\conf\extra\httpd-xampp.conf file with a line:

Alias /private "/xampp/private"

If you want to password protect it, or give it any other special directives you would follow that line with a directory block:

<Directory "/xampp/private">
    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile /xampp/htpasswd-private
    Require user foo
</Directory>

Any time you make changes to these files you need to restart Apache for them to take effect.

WerkkreW
  • 5,969
  • 3
  • 24
  • 32
0

Thanks to WerkkreW, I added an alias for my private folder as below. I can now access my apps from /localhost/private/myapp.

Alias /private "C:/xampp/private/"
<Directory "C:/xampp/private/">
    Order allow,deny
    Allow from all
</Directory>

But, I still need to run my app /localhost/private/myapp as /localhost/myapp. Thus, I tried an alias as below :

Alias / "C:/xampp/private/"
<Directory "C:/xampp/private/">
    Order allow,deny
    Allow from all
</Directory>

I think it is a wrong usage and I cannot access my apps in C:\xampp\htdocs

Sithu
  • 111
  • 4