Trying to configure a local domain alias to use ith Drupal 8.3.4, WampServer, and Windows 7…

I’m running Windows 7 64bit with WampServer 3.1x (also 64bit) to do my Drupal 8.3.4 development work. I need some insights into how to use an alias with Drupal 8.3.4.

In my HOSTS file, I have the following entries:

::1 #Pre-existing Drupal 7 project.
::1 #The Drupal 8 project I'm trying to work on.

When accessing my Drupal 8 install in the URL via “http://localhost/projects/foobar_drupal_8/,” everything works as expected. But as soon as I try to access “,” I get the following error:

Redirects to external URLs are not allowed by default, use DrupalCoreRoutingTrustedRedirectResponse for it.

After researching things, I came to learn that this is due to a security measure that D8 has to prevent spoofing. Okay, so thinking that “” needs to be placed in the “$settings[‘trusted_host_patterns’]” array (as others have suggested in other similar cases I found on Google), I added the following to the array in /sites/default/settings.php:

$settings['trusted_host_patterns'] = [

…but after doing this, I then attempt to go to “” where I get the following error:

The provided host name is not valid for this server.

At that point, the alias and “http://localhost/projects/foobar_drupal_8/” no longer function and to make the latter at least work, I have to remove the array entry I made above. So frustrating!

Long story short, all I’m trying to do here is use a domain alias on my local web server… It was pretty easy to set up in D7 but now in D8, it seems like a nightmare.

What am I doing wrong here?

Drupal version: