need help:adding more documentroot

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

need help:adding more documentroot

Postby krazzie25 » 07. January 2008 04:32

I currently using xampp 1.6.5.
The installation folder was at C:\xampp.

I need help in adding more documentroot for my website at another partition for example D:\mywebsite.But I also want to keep the default htdocs which is in C:\xampp\htdocs.

I read some guide that said to change the httpd.conf in C:\xampp\apache\conf.....but i kind of lost..and dont know how to do it

another guide said to add virtual host..i manage to make it read the D:\mywebsite as the root but cannot read from C:\xampp\htdocs.

Can anyone help me to solve this problem..
krazzie25
 
Posts: 3
Joined: 07. January 2008 03:19

Postby Izzy » 07. January 2008 05:15

With the details you have posted it would be close to impossible to give you a solution.

Paste you httpd-vhosts.conf file here.

Also return your httpd.conf file to the defaults - you did make a backup?

In the mean time read this post for clues:
http://community.apachefriends.org/f/viewtopic.php?t=27892
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby krazzie25 » 07. January 2008 10:14

Is it really impossible?
I have read the post that you refer to me...still dont have any improvement.

here is my httpd-vhosts.conf

Code: Select all
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host2.example.com
##    DocumentRoot /www/docs/dummy-host2.example.com
##    ServerName dummy-host2.example.com
##    ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
##</VirtualHost>


NameVirtualHost *:80

<VirtualHost *:80>
ServerName MyWebsite
ServerAlias MyWebsite
DocumentRoot "D:/MyWebsite"
<Directory />
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>



I already return the default httpd.conf.
krazzie25
 
Posts: 3
Joined: 07. January 2008 03:19

Postby Izzy » 07. January 2008 11:20

It really is impossible to help if you don't provide all the details in the first place - see what can be done when you include enough detail to be able to effect a solution. :)


Try this but you will have to change the paths to suit your own if they are wrong and add this below the last ##comment lines:
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName MyWebsite
ServerAlias www.MyWebsite
DocumentRoot "D:/MyWebsite"
<Directory "D:/MyWebsite">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

AllowOverride All is the default which is usually used by most and here are the Apache docs for that directive just so you know what you are doing when you use the AllowOverride FileInfo directive:
http://httpd.apache.org/docs/2.2/mod/co ... owoverride

For a complete list of Apache directives for reference:
http://httpd.apache.org/docs/2.2/mod/directives.html

ServerAlias is used for another name for your server not the same name as your server.

Always remember that Apache is case sensitive - MyWebsite is very different to mywebsite.

All the lines starting with a # or ## are comments and take no part in the running of the httpd-vhosts.conf file and are only for help with configurations.

Drag this file into your text editor
C:\WINDOWS\system32\drivers\etc\hosts

and add these lines if they are not there already:

127.0.0.1 localhost
127.0.0.1 MyWebsite


Save the file.

Restart Apache to have your edits in the httpd-vhosts.conf file recognozed.

Now you should be able to access your sites like this:
http://localhost = XAMPP Welcome Page
http://MyWebsite = your website.
http://www.MyWebsite = your web site

Make sure you clear your browser's cache regularly when developing and more so at localhost level as the cache can be your worst enemy serving you old pages stored in the cache.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby krazzie25 » 07. January 2008 14:37

Yeaaa!!!!! thanks a lot Izzy...problem solved.
thank you so much for your guide...i guess its my mistake...

Code: Select all


NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName MyWebsite
#ServerAlias www.MyWebsite
DocumentRoot "D:/MyWebsite"
<Directory "D:/MyWebsite">
Options Indexes FollowSymLinks Includes ExecCGI
#AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>




after comment the code ServerAlias and AllowOverride All (see the code above) the both documentroot at my C:/xampp/htdocs and D:/MyWebsite works...now I can access both http://localhost/ and http://MyWebsite/ which both refer to C:/xampp/htdocs and D:/MyWebsite.

I did not know that those that i commented effect the document root.
Thanks again Izzy.
krazzie25
 
Posts: 3
Joined: 07. January 2008 03:19


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 121 guests