新虚拟主机 301 - 重定向到旧虚拟主机
我在 Debian Linux 上安装了 apache。虚拟主机,在文件 /etc/apache2/sites-enabled/site.conf 中进行了描述,类似
<VirtualHost *:80>
ServerName site.com
DocumentRoot /var/www/site
</VirtualHost>
我已将新的虚拟主机添加到此文件中,所以现在此文件看起来像
<VirtualHost *:80>
ServerName site.com
DocumentRoot /var/www/site
</VirtualHost>
<VirtualHost *:80>
ServerName site-mirror.com
ServerAlias *.site-mirror.com
DocumentRoot /var/www/site
</VirtualHost>
并重新启动了 apache
/etc/init.d/apache2 reload
现在,当我去时到 site-mirror.com,apache 将我重定向到 site.com(301 重定向)
可能是什么问题?
我将不胜感激任何帮助,谢谢
I have an apache installed on Debian Linux. A virtual host, which is described in the file /etc/apache2/sites-enabled/site.conf, something like that
<VirtualHost *:80>
ServerName site.com
DocumentRoot /var/www/site
</VirtualHost>
I have added new Virtual Host to this file, so now this file looks like
<VirtualHost *:80>
ServerName site.com
DocumentRoot /var/www/site
</VirtualHost>
<VirtualHost *:80>
ServerName site-mirror.com
ServerAlias *.site-mirror.com
DocumentRoot /var/www/site
</VirtualHost>
and restarted apache
/etc/init.d/apache2 reload
Now, when I go to site-mirror.com, apache redirects me to site.com (301 redirect)
What could be the problem ?
I will appreciate any help, thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为重定向是由 WordPress 完成的,以防止 SEO 问题。你需要一些特定于 wordress 的模块来支持同一 WordPress 安装上的多域访问,例如 这个,域主题。
I think the redirection is done by wordpress to prevent SEO problems. you'll need some wordress specific module to support multi-domain access on the same wordpress installation like this one, domain-theme.
一个非常快速的猜测,但事实上两个 DocumentRoots 是相同的,这可能会欺骗 apache 并将其视为重定向,尝试更改镜像 documentroot 并查看是否仍然得到
301。Dave
A very quick guess but the fact that both DocumentRoots are the same may be tricking apache and treating it as a redirect, try changing the mirror documentroot and see if you still get the 301.
Dave