AMPPS: create domain wildcard on Windows 10 - solved!

How to solve problem with new added domain, which is not working well.. and how to create wildcard alias for its subdomains.

I love AMPPS! It is fast way to make your Windows machine able to develop dynamic applications and lot of more.

Create domain project.local

  • start AMMPS with administration rights (allowed access to etc/hosts file)
  • on homepage click to Add domain
  • domain name is project.local
  • Domain Addon or Parked checked
  • my path is like c:/dev/project/www
  • Add an entry to Host File checked

Problem

If I try to look at http://project.local, there is no my site, but directory listing of AMMPS located in c:\Program Files (x86)\Ampps\www\. This is DocumentRoot setting in httpd-vhosts.conf. Configuration contains also

ServerName 127.0.0.1:80

Virtual host is created ok in c:\Program Files (x86)\Ampps\apache\conf\extra\httpd-vhosts.conf and looks like this:

<VirtualHost 127.0.0.1:80>
  <Directory "c:/dev/project/www">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
  </Directory>
  ServerName project.local
  ServerAlias project.local
  ScriptAlias /cgi-bin/ "c:/dev/project/www/cgi-bin/"
  DocumentRoot "c:/dev/project/www"
  ErrorLog "C:/Program Files (x86)/Ampps/apache/logs/project.local.err"
  CustomLog "C:/Program Files (x86)/Ampps/apache/logs/project.local.log" combined
</VirtualHost>

I also need to work with subdomains like test.project.local, test2.project.local, test3.project.local etc.

Notice: Try to look at Windows vhosts file and check if there is route for specific domain only once, because it can cause bad routing.

127.0.0.1   project.local
127.0.0.1   project.local

Solution 

Change Virtual host tag to specific domain name, and change ServerAlias to wildcard:

<VirtualHost 127.0.0.1:80>
  <Directory "c:/dev/project/www">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
  </Directory>
  ServerName project.local
  ServerAlias *.project.local
  ScriptAlias /cgi-bin/ "c:/dev/project/www/cgi-bin/"
  DocumentRoot "c:/dev/project/www"
  ErrorLog "C:/Program Files (x86)/Ampps/apache/logs/project.local.err"
  CustomLog "C:/Program Files (x86)/Ampps/apache/logs/project.local.log" combined
</VirtualHost>

And restart Apache server and it works! Domain is working, and also any subdomains are accessible.

And of course same change for SSL mode access..

<IfModule ssl_module>
   <VirtualHost 127.0.0.1:443>
    <Directory "c:/dev/project/www">
       Options FollowSymLinks
       Indexes AllowOverride All 
       Order deny,allow 
       allow from All
    </Directory>
    ServerName project.local
​​​​​​​    ServerAlias *.project.local
...

But..

Each time you create new domain by AMPPS, httpd-vhosts.conf configuration will be overwrited by AMMPS! It is suggested as phorum topic, so we will see in future if it will be implemented as optional setting.