'How do I change the webroot within a WAMP project?

I am trying to install Craft CMS locally.

My WAMP is installed and working fine. I can put project folders inside (for example) C:\wamp64\www\projectname

Then I can visit localhost/projectname in my browser to view the index.html

However, Craft CMS has a folder structure like this, whereby the 'web' folder needs to be the webroot:

C:\wamp64\www\craft
├── config
│   └── ...
├── modules
│   └── ...
├── storage
│   └── ...
├── templates
│   └── ...
├── vendor
│   └── ...
├── web
│   └── ...
├── .env
├── .env.example
├── .gitignore
├── composer.json
├── composer.lock
└── craft

How do I configure WAMP so that when I visit my craft project (localhost/craft) that I want it to load C:\wamp64\www\craft\web instead of C:\wamp64\www\craft



Solution 1:[1]

So the answer was to set up a virtualhost.

Visit 'localhost', choose 'add virtual; host'

Solution 2:[2]

We think this is up to your server.

You need to configure your webserver/virtualhost to point to the /web directory.

For apache, you have DocumentRoot: your_disk_path/web

For Nginx you have root: your_disk_path/web

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mike_freegan
Solution 2 Dotsquares