ServerAlias不起作用

Ant*_*mov 8 apache server-name

我有ServerAlias指令的问题.配置如下所示:

ServerName d.geosurf.ru
ServerAlias www.d.geosurf.ru divo32pro.ru www.divo32pro.ru
Run Code Online (Sandbox Code Playgroud)

但!每次当我尝试去divo32pro.ru时,我得到d.geosurf.ru(servername).好像没有重定向,但有些不对劲......有什么想法?...

Ian*_*rts 13

ServerAlias简单地声明可用于处理同一站点的替代名称(或者<VirtualHost>.如果我有

ServerName www.example.com
ServerAlias example.com
Run Code Online (Sandbox Code Playgroud)

我会看到两个相同的内容http://www.example.com/foo/http://example.com/foo/.

但是,如果Apache服务器由于任何原因需要发出重定向(例如,从没有斜杠的目录名到带斜杠的相应名称),则行为取决于UseCanonicalName设置.如果未指定,或者Off它将执行您期望的操作(http://example.com/foo- > http://example.com/foo/),但如果设置为,On则重定向将是ServerName与原始请求URL无关(即http://example.com/foo- > http://www.example.com/foo/).检查配置中是否有此设置.


Joh*_*ell 3

ServerAlias不会将您重定向到新网站。

ServerName只是说“这是我的服务器名称”,并ServerAlias说如果有人访问 XY 或 Z,请像直接访问 XY 或 Z 一样对待他们ServerName