41

After I installed Apache on my web server there was created a folder called www. Whatever files like HTML and PHP files I put there it will be on my website.

However, I followed one of the tutorial on YouTube and also even my own XAMPP folder has a htdocs folder which is the same as the www folder. When I put a file inside I can see it if I type its name after localhost. Is there any difference between these two? How have we defined these directories as a container of our files?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bernard
  • 4,240
  • 18
  • 55
  • 88

6 Answers6

34

There is no difference. You can configure Apache httpd to use any folder with appropriate permissions as the root server directory. www is just a conventional directory to use.

jeremyjjbrown
  • 7,772
  • 5
  • 43
  • 55
13

Depending on the configuration of the server or the system, you can use the folder where the files of your web application are copied (.html, .php, etc.). This folder have different names, but basically it is a folder with "permits public access".

The folder can be called this on Linux systems:

  • htdocs
  • public_html
  • www

In OS X (Apple), this folder is called "Sites", and in Windows Server it is called "WWWroot".

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joseph Collins
  • 441
  • 2
  • 9
6

It really all depends on the server configuration. Sometimes hosts will configure www to be document root, sometimes htdocs will be for other applications (this is just an example).

Either way, both are public and there is no difference as far as standard configuration goes.

Like I said though, it really depends on the server configuration.

All of your configured settings can be found in httpd.conf

user2815333
  • 486
  • 1
  • 3
  • 9
3

This folder is the so-called Document-Root of the server. It will be defined via the DocumentRoot-Directive.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
3

Apache will use whatever folder it's configured to use: you could call it whatever you want. Common conventions include htdocs, httpdocs, and www, but you could also make up your own if you felt like it.

TRiG
  • 10,148
  • 7
  • 57
  • 107
-1

Apache will use whatever folder it's configured to use: you could call it whatever you want.

Common conventions include htdocs, httpdocs, and www, but you could also make up your own if you felt like it by yourself.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 2
    It is not very useful to essentially repeat what was already answered 7 years ago in several answers. – trincot Jan 26 '21 at 12:22