将 www 子域转发到域

发布于 2024-10-19 07:14:37 字数 159 浏览 7 评论 0原文

如何将输入为 www.example.com 或 www.example.com/blah/blah 的 URL 自动转发/转向/转换(无论正确的术语是什么)为 example.com 或 example.com/blah/blah?我基本上想将 www 子域中的任何内容转发到该域,包括路径(如果有)。

How do I auto forward/turn/convert (whatever the correct term is) URLs entered as www.example.com or www.example.com/blah/blah to example.com or example.com/blah/blah? I basically want to push anything coming in with the www subdomain to forward to the domain including the paths (if any).

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

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

发布评论

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

评论(1

岁月静好 2024-10-26 07:14:37

在你的 htaccess 文件中使用这个

RewriteEngine On    
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]    
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

In your htaccess file use this

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