新虚拟主机 301 - 重定向到旧虚拟主机

发布于 2024-12-26 08:05:02 字数 682 浏览 3 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡看悲欢离合 2025-01-02 08:05:02

我认为重定向是由 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.

梦里泪两行 2025-01-02 08:05:02

一个非常快速的猜测,但事实上两个 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文