24

Also is the web server root directory the place where you put your site files and later acces them with localhost/file_name in the browser?

ionescho
  • 1,265
  • 2
  • 16
  • 29

7 Answers7

34

If you installed WAMP to c:\wamp then I believe your webserver root directory would be c:\wamp\www, however this might vary depending on version.

Yes, this is where you would put your site files to access them through a browser.

Jordan S. Jones
  • 12,909
  • 4
  • 40
  • 49
20

In WAMP the files are served by the Apache component (the A in WAMP).

In Apache, by default the files served are located in the subdirectory htdocs of the installation directory. But this can be changed, and is actually changed when WAMP installs Apache.

The location from where the files are served is named the DocumentRoot, and is defined using a variable in Apache configuration file. The default value is the subdirectory htdocs relative to what is named the ServerRoot directory.

By default the ServerRoot is the installation directory of Apache. However this can also be redefined into the configuration file, or using the -d option of the command httpd which is used to launch Apache. The value in the configuration file overrides the -d option.

The configuration file is by default conf/httpd.conf relative to ServerRoot. But this can be changed using the -f option of command httpd.

When WAMP installs itself, it modify the default configuration file with DocumentRoot c:/wamp/www/. The files to be served need to be located here and not in the htdocs default directory.

You may change this location set by WAMP, either by modifying DocumentRoot in the default configuration file, or by using one of the two command line options -f or -d which point explicitly or implicity to a new configuration file which may hold a different value for DocumentRoot (in that case the new file needs to contain this definition, but also the rest of the configuration found in the default configuration file).

mins
  • 4,503
  • 9
  • 45
  • 62
3

Everything suggested by user "mins" is correct, and excellent information.

WAMP 2.5 provides a default Server Configuration display when you enter localhost into your browser. This maps to c:\wamp\www, as described in previous posts. Creating subdirectories under www will cause Projects to appear on this display. A click and you're in your project.

I have various projects under different directory structures, sometimes on shared drives which makes this centralized location of files inconvenient. Luckily, there is a second feature of WAMP 2.5, an Alias, which makes specifying the location of one (or more) disparate web directories quite easy. No editing of configuration files. Using the WAMP menu, choose Apache > Alias directories > Add an Alias.

WAMP has evolved nicely to provide support for a variety of developer preferences.

OldMan
  • 2,046
  • 1
  • 9
  • 5
3

If you use Bitnami installer for wampstack, go to:

c:/Bitnami/wampstack-5.6.24-0/apache/conf (of course your version number may be different)

Open the file: httpd.conf in a text editor like Visual Studio code or Notepad ++

Do a search for "DocumentRoot". See image.

Screenshot

You will be able to change the directory in this file.

M. Adeel Khalid
  • 1,770
  • 2
  • 21
  • 24
Gregory Smitherman
  • 260
  • 1
  • 6
  • 16
2

To check what is your root directory go to httpd.conf file of apache and search for "DocumentRoot".The location following it is your root directory

Vallabh Lakade
  • 672
  • 5
  • 19
  • Most of the answers presume that user installed wampserver in wamp folder. This answer is handy! Thank you. – PC. Jul 06 '16 at 16:02
1

this is the path to the web root directory c:\wamp\www

you can create different projects by adding different folders to this directory and call them like:

localhost/project1 from browser

this will run the index.html or index.php, lying inside project1

KawaiKx
  • 8,125
  • 15
  • 64
  • 91
0

Here's how I get there using Version 3.0.6 on Windows

Jaad Chacra
  • 489
  • 6
  • 12