htaccess问题

发布于 2024-09-30 17:56:19 字数 191 浏览 0 评论 0原文

嘿,在 Plesk 中,它使我能够向 xycom 等域添加子域,问题是 www.xycom 被视为另一个子域。有没有办法将所有流量从 www.xycom 定向到 xycom?我尝试使用 300 标头在 php 中执行此操作,但像 www.xycom/mypage 这样的内容不会被重定向。我可以使用 .htaccess 文件重定向所有这些流量吗?

谢谢

Hay, In Plesk it gives me the ability to add a subdomain to a domain say x.y.com, the problem is that www.x.y.com gets treated as another subdomain. Is there a way to direct all traffic from www.x.y.com to x.y.com? I tried doing this in php using the 300 header, but stuff like www.x.y.com/mypage, doesn't get redirected. Could i use the .htaccess file to redirect all this traffic?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

鸵鸟症 2024-10-07 17:56:19
# you probably want www.example.com to forward to example.com -- shorter URLs are sexier.
# no-www.org/faq.php?q=class_b
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

来源:http://html5boilerplate.com

# you probably want www.example.com to forward to example.com -- shorter URLs are sexier.
# no-www.org/faq.php?q=class_b
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

Source: http://html5boilerplate.com

生来就爱笑 2024-10-07 17:56:19
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^www.domain.com [nc]
rewriterule ^(.*)$ http://domain.com/$1 [r=301,nc]

来自: http://www.webconfs.com/how-to-redirect -a-webpage.php

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^www.domain.com [nc]
rewriterule ^(.*)$ http://domain.com/$1 [r=301,nc]

From: http://www.webconfs.com/how-to-redirect-a-webpage.php

有深☉意 2024-10-07 17:56:19
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.x.y.com [NC]
RewriteRule ^(.*)$ http://x.y.com/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.x.y.com [NC]
RewriteRule ^(.*)$ http://x.y.com/$1 [R=301,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文