I have a VM windows server 2022 running XAMPP. The server is named server2022. I will browse localy and remote to this server.
What I want is:
http(s)://localhost -> show default content of xampp/htdocs/
http(s)://server2022 -> show default content of xampp/htdocs/
http(s)://sitename.localhost -> show default content of xampp/htdocs/websites/sitename/httpdocs
http(s)://sitename.server2022 -> show default content of xampp/htdocs/websites/sitename/httpdocs
To achieve this I edited httpd-vhost.conf
UseCanonicalName off
<VirtualHost *:80 *:443>
DocumentRoot "W:/xampp/htdocs/"
ServerName server2022
ServerAlias localhost
</VirtualHost>
<VirtualHost *:80 *:443>
ServerAlias *.localhost
ServerAlias *.server2022
VirtualDocumentRoot "W:/xampp/htdocs/websites/%-2/"
</VirtualHost>
Rule 1 works for both (on the browser form the server localy)
Rule 2 only works for locahost.
Any Ideas for fixing this are welcome?