非 www 到 www htaccess 重定向

发布于 2024-09-19 02:07:58 字数 186 浏览 1 评论 0原文

我有一个 .net 网址,它与前面的 www 完美配合,但是当网址只是 http://example.net< /a> 它打开了一个正在建设的页面。

我尝试了各种 .htaccess 文件,但没有任何效果!帮助!

I have a .net url which works perfectly with the www in front of it but when the url is just http://example.net its bringing up an under construction page.

I have tried all sorts of .htaccess files but nothing is working! Help!

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

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

发布评论

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

评论(2

猫九 2024-09-26 02:07:58

我不是网络开发人员,也不是系统管理员,但我认为默认域必须指向子域 www 指向的同一目录。

在我看来,默认情况是 example.com 会引导您的内容,而 www.example.com 会转发到 example.com。这就是它的完成方式(根据 http://no-www.org/):

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

Im not a web developer nor a sys admin, but i think the default domain has to point to the same directory the subdomain www points to.

Imo the default is, that example.com leads to your content and www.example.com forwards to example.com. That's how it's done (according to http://no-www.org/):

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