我有一个域example.com。我想把help.example.com映射到example.com。DNS记录如下:
Hostname Type Value
example.com A 93.184.216.34
help.example.com A 93.184.216.34
www.example.com CNAME example.com我可以使用example.com和www.example.com访问这个网站,但是当我尝试help.example.com时,我得到了404 Not Found。
未找到 在此服务器上找不到请求的URL /。 此外,在尝试使用ErrorDocument处理请求时遇到了一个404未找到的错误。
所以我想知道为什么A记录help.example.com不重定向到example.com。
额外信息:
example.com/some_random_string,就会得到(如预期的) Cannot find that URL。但是,如果我试图访问help.example.com/some_random_string,就会得到上面的Not Found消息。因此,.htaccess似乎被help.example.com忽略了example.com、www.example.com和help.example.com返回相同的IP地址。A记录替换为:
help.example.com CNAME example.com
但这将返回相同的Not Found消息。发布于 2019-07-27 20:10:53
您的问题是在Your服务器配置中。在DNS里一点也没有。
我假设您使用Apache,所以您需要告诉Apache example.com www.example.com help.example.com有相同的根目录。
例如,如果您使用VirualHost配置和Ubuntu,那么查看/etc/apache2/sites-enabled/example.com.conf
它应该有
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com help.example.com
...
</VirtualHost>如果您使用其他OS/ configuration /WebServer,您可以使用google/查看您的配置如何工作,以及在何处添加您的域名。在DNS里不行。
发布于 2019-07-27 20:10:12
在CNAME的记录中遗漏了一些点。它应该是
help.example.com. CNAME example.com.所谓的FQDN (完全限定域名)应该在CNAME记录中使用。如果没有点名称服务器,则将值$origin变量追加到末尾。
https://stackoverflow.com/questions/57235569
复制相似问题