0

How to setup local Apache to be both reachable with www(www.site.com) and without (site.com) in Windows 10?

Apache such: httpd-2.4.39-win64-VC15

3
  • 4
    Windows is totally unrelated. You may be looking for the ServerAlias directive...?
    – Daniel B
    Jun 4, 2019 at 12:32
  • may you add example?
    – Vytas P.
    Jun 4, 2019 at 12:36
  • 2
    As @DanielB said, check the ServerName and ServerAlias directives.
    – ivanivan
    Jun 4, 2019 at 13:04

1 Answer 1

1

In C:\Windows\System32\drivers\etc\hosts

127.0.0.1       site.com
127.0.0.1   www.site.com

in C:\Apache24\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot C:/Apache24/htdocs/site.com
    ServerName site.com
    ServerAlias www.site.com 
</VirtualHost>

It works!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .