Newbie question - changing use of htdocs

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

Newbie question - changing use of htdocs

Postby eatc7402 » 01. June 2013 04:41

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
eatc7402
 
Posts: 2
Joined: 31. May 2013 10:05
Operating System: Win 7 (64

Re: Newbie question - changing use of htdocs

Postby Altrea » 01. June 2013 08:16

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 47 guests