使用特定的 TLD XAMPP 虚拟主机重定向所有内容
Redirect everything with a specific TLD XAMPP vhost
所以有多个域指向 1 个网络服务器
说:
example1.com
example2.com
example3.com
...........
...........
他们都将被重定向到 http://example.com
现在,在虚拟主机的 Apache 配置中,我会有这个:
<VirtualHost *:80>
ServerName example.com
ServerAlias [SOMETHING THAT WOULD MATCH EVERY .COM DOMAIN]
DocumentRoot "C:/xampp/htdocs/onion"
</VirtualHost>
我需要一段可以匹配任何 .com 域的代码(在 ServerAlias 之后)
提前致谢:)
您可以使用通配符(*) 将多个域名匹配到Apache 虚拟主机。来自 original Apache documentation
Many servers want to be accessible by more than one name. This is
possible with the ServerAlias directive, placed inside the
section. For example in the first block
above, the ServerAlias directive indicates that the listed names are
other names which people can use to see that same web site:
ServerAlias example.com *.example.com
then requests for all hosts in the example.com domain will be served
by the www.example.com virtual host. The wildcard characters * and ?
can be used to match names. Of course, you can't just make up names
and place them in ServerName or ServerAlias. You must first have your
DNS server properly configured to map those names to an IP address
associated with your server.
所以基本上如果你想重定向所有 .com 请求你会做:
ServerAlias *.com
所以有多个域指向 1 个网络服务器
说:
example1.com
example2.com
example3.com
...........
...........
他们都将被重定向到 http://example.com
现在,在虚拟主机的 Apache 配置中,我会有这个:
<VirtualHost *:80>
ServerName example.com
ServerAlias [SOMETHING THAT WOULD MATCH EVERY .COM DOMAIN]
DocumentRoot "C:/xampp/htdocs/onion"
</VirtualHost>
我需要一段可以匹配任何 .com 域的代码(在 ServerAlias 之后)
提前致谢:)
您可以使用通配符(*) 将多个域名匹配到Apache 虚拟主机。来自 original Apache documentation
Many servers want to be accessible by more than one name. This is possible with the ServerAlias directive, placed inside the section. For example in the first block above, the ServerAlias directive indicates that the listed names are other names which people can use to see that same web site:
ServerAlias example.com *.example.com
then requests for all hosts in the example.com domain will be served by the www.example.com virtual host. The wildcard characters * and ? can be used to match names. Of course, you can't just make up names and place them in ServerName or ServerAlias. You must first have your DNS server properly configured to map those names to an IP address associated with your server.
所以基本上如果你想重定向所有 .com 请求你会做:
ServerAlias *.com