Using apache htdocs folder

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

Using apache htdocs folder

Postby bmandk » 10. June 2011 15:22

I have recently installed Xammp, and this is the first time i am using it. I have installed it because i want a way to test my website before i put it online. So i put my website under C:\Xammp\apache\htdocs and go to localhost/ in my browser. It then goes to the Xammp control panel, and i was thinking that it was just some first time configuration. So i make some configurations, and type localhost/ in my browser again, but same thing. So how do i make Xammp redirect to the apache htdocs instead?
bmandk
 
Posts: 3
Joined: 10. June 2011 15:15

Re: Using apache htdocs folder

Postby JonB » 10. June 2011 17:04

You will need to either:

Point specifically to the page that your website opens with (say index.html) - so point to http://localhost/index.html in that case (probably easiest)
~~ note on your webhost this will NOT be an issue ~~
OR

fix the auto-redirection that is occurring, (involves fixing a few configuration files - and it may not be something you will need to learn about to work on your website)

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Using apache htdocs folder

Postby bmandk » 10. June 2011 18:02

I think you misunderstood me. Instead of using C:\Xammp\htdocs as root for websites, i would like to use C:\Xammp\apache\htdocs.
bmandk
 
Posts: 3
Joined: 10. June 2011 15:15

Re: Using apache htdocs folder

Postby JonB » 10. June 2011 19:07

no problem, but I suggest you NOT put it under apache

you need to change the mapping in this line in xampp\apache\conf\httpd.conf:

DocumentRoot "C:/xampp/htdocs"

I suggest you just create a different folder directly under xampp, such as 'sites' or public_html (which would follow a common practive). There actaully is no rule about what a document root needs to be named, other than 'no spaces or specail characters'. My suggestion is for a variety of valid structual reasons that it would be pointless to enumerate at the moment. If you aren't going to expose the server to the internet, it just doesn't matter.

Good Luck
:) :)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Using apache htdocs folder

Postby bmandk » 10. June 2011 21:31

I went in there, but it was already set to C:/xampp/apache/htdocs :S
bmandk
 
Posts: 3
Joined: 10. June 2011 15:15

Re: Using apache htdocs folder

Postby Sharley » 11. June 2011 01:45

bmandk wrote:I went in there, but it was already set to C:/xampp/apache/htdocs :S
What version of XAMPP did you install?
You must have changed that entry yourself at some stage.

When ever a change is made to the server's DocumentRoot you will also need to change this Directory directive entry a little lower down in the httpd.conf file, as pointed out in the entries comments
Code: Select all
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/xampp/apache/htdocs">
Restart Apache and then go to http://localhost and using the default included index.html file in that folder you should see It Works! in your browser - replace that included index file with one from your web site and you will be all set to move ever so cautiously forward.


As pointed out by the previous poster JonB, the method you are wanting to use is not recommended as it may open an unexpected security hole that may in some cases expose your files and folders on your PC to a knowledgeable script kiddie attack or, worse still, create another XAMPP zombie server, of which there are far too many already, created by mal configurations of the type you propose.


Best practice is to keep the httpd.conf file as the installation defaults and if you require to individualize your server then use the configuration files included in the C:\xampp\apache\conf\extra folder and specifically for your needs the httpd-vhosts.conf file which allows a DocumentRoot anywhere on your PC coupled to any ServerName you wish to use - these configuration files override entries found in the httpd.conf file as these files are read after the httpd.conf file server's defaults.

But, having said all that, it is after all, your server and your computer and so ultimately the choice is entirely yours how you configure it, all we can do in reply is offer our advise based on our knowledge and past experiences.

So good luck with your projects using XAMPP as a test bed server suite. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 48 guests