Apache Config - 如何将所有域转发到一个域

时间:2021-09-28 16:54:16

I have a new dedicated server with cPanel/WHM. I've created 1 account only (I won't need more accounts): maindomain.com

我有一个新的专用服务器与cPanel / WHM。我只创建了一个帐户(我不需要更多帐户):maindomain.com

I want ALL domains pointing to my DNSs (more than 50) to be forwarded (NOT redirected) to maindomain.com automatically (without creating entries for each domain)

我希望所有指向我的DNS(超过50个)的域自动转发(未重定向)到maindomain.com(不为每个域创建条目)

In httpd.conf I've set ServerAlias * for the domain, but to no avail (Yes, I've restarted apache!).

在httpd.conf中,我为域设置了ServerAlias *,但无济于事(是的,我重新启动了apache!)。

Note that the idea is very similar to what parking sites do. Once you set their DNSs, the site contents are the "same" for every domain.

请注意,这个想法与停车场的做法非常相似。设置DNS后,每个域的站点内容都“相同”。

So, What should I configure to forward domains to a particular one?

那么,我应该配置什么来将域转发给特定的域?

1 个解决方案

#1


1  

All non matching domains are forwarded by default to the first one in the configuration files. So, simply put the virtualhost on top of your config file, or if you're using one file per virtualhost, name it (the file) as 00-something (config files are loaded alphabetically)

默认情况下,所有不匹配的域都会转发到配置文件中的第一个域。因此,只需将虚拟主机放在配置文件的顶部,或者如果您为每个虚拟主机使用一个文件,请将其命名为(文件)为00-something(配置文件按字母顺序加载)

#1


1  

All non matching domains are forwarded by default to the first one in the configuration files. So, simply put the virtualhost on top of your config file, or if you're using one file per virtualhost, name it (the file) as 00-something (config files are loaded alphabetically)

默认情况下,所有不匹配的域都会转发到配置文件中的第一个域。因此,只需将虚拟主机放在配置文件的顶部,或者如果您为每个虚拟主机使用一个文件,请将其命名为(文件)为00-something(配置文件按字母顺序加载)