Page 1 of 1

Newbie question - changing use of htdocs

PostPosted: 01. June 2013 04:41
by eatc7402
I want to set my working 1.7.7 version Xampp to use directories OTHER that htdocs as my 'local website' location.
What is the proper way to do it?

eatc7402

Re: Newbie question - changing use of htdocs

PostPosted: 01. June 2013 08:16
by Altrea
Hi eatc7402,

Please start new threads with the words "Hi" or "Hello". A short salutation is an act of politeness. Even if the internet is an virtual area, there is always a human being behind the screen. A polite beginning is the first positive impression you can leave here and helps to get polite answers too. Please keep that in mind if you start a new thread in any community board. Thank you.

eatc7402 wrote:I want to set my working 1.7.7 version Xampp to use directories OTHER that htdocs as my 'local website' location.
What is the proper way to do it?

If they don't need an own URL i would use Alias for it:

Code: Select all
## will match http://localhost/location1
Alias /location1 "C:/xampp/location1"
<Directory "C:/location1">
    Order allow,deny
    Allow from all
</Directory>

## will match http://localhost/location2
Alias /location2 "C:/xampp/location2"
<Directory "C:/location1">
    Order allow,deny
    Allow from all
</Directory>

http://httpd.apache.org/docs/2.2/mod/mo ... html#alias

If you need own URLs, you can use virtual hosts for it:
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
   DocumentRoot "C:/xampp/htdocs"
   ServerName localhost
</VirtualHost>

## will match http://location1
<VirtualHost *:80>
   DocumentRoot "C:/location1"
   ServerName location1
   <Directory "C:/location1">
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

## will match http://location2
<VirtualHost *:80>
   DocumentRoot "C:/location2"
   ServerName location2
   <Directory "C:/location2">
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

Of cause you need to make sure that these URLs get routed to your Server XAMPP is running on (DNS Server, Windows HOSTS file, etc).
http://httpd.apache.org/docs/2.2/mod/co ... irtualhost

best wishes,
Altrea