简体   繁体   English

ServerAlias不起作用

[英]ServerAlias doesn't work

I have problem with ServerAlias directive. 我有ServerAlias指令的问题。 Configuration looks like this: 配置如下所示:

ServerName d.geosurf.ru
ServerAlias www.d.geosurf.ru divo32pro.ru www.divo32pro.ru

But! 但! Everytime when I try to go to divo32pro.ru, for example, i get d.geosurf.ru (servername). 每次当我尝试去divo32pro.ru时,我得到d.geosurf.ru(servername)。 It seems like there's no redirect, but something wrong... Any ideas?.. 好像没有重定向,但有些不对劲......有什么想法?...

ServerAlias simply declares alternative names that can be used to address the same site (or <VirtualHost> . So if I have ServerAlias只是声明可用于寻址同一站点的替代名称(或<VirtualHost> 。所以,如果我有

ServerName www.example.com
ServerAlias example.com

I will see the same content for both http://www.example.com/foo/ and http://example.com/foo/ . 我将在http://www.example.com/foo/http://example.com/foo/看到相同的内容。

However, if the Apache server needs to issue a redirect for any reason (for example from a directory name without a trailing slash to the corresponding name with the slash), the behaviour depends on the UseCanonicalName setting. 但是,如果Apache服务器由于任何原因需要发出重定向(例如,从没有斜杠的目录名到斜杠的相应名称),则行为取决于UseCanonicalName设置。 If this is unspecified or Off then it will do what you would expect ( http://example.com/foo -> http://example.com/foo/ ) but if it is set to On then the redirect will be to the ServerName regardless of the original request URL (ie http://example.com/foo -> http://www.example.com/foo/ ). 如果未指定或Off那么它将执行您期望的操作( http://example.com/foo - > http://example.com/foo/ ),但如果将其设置为On则重定向将是ServerName与原始请求URL无关(即http://example.com/foo - > http://www.example.com/foo/ )。 Check if you have this set in your configuration. 检查配置中是否有此设置。

ServerAlias doesn't redirect you to the new site. ServerAlias不会将您重定向到新站点。

ServerName just says "here is my server name" and ServerAlias says if anyone goes to XY or Z then please treat them as if they came direct to ServerName ServerName只是说“这是我的服务器名称”, ServerAlias说如果有人去XY或Z那么请把它们当作直接用于ServerName对待

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM