Godaddy 中的规范名称重定向?

发布于 2024-08-02 07:08:54 字数 640 浏览 13 评论 0原文

我有一个网站“mywebsite.com”,我想对“http://mywebsite.com”到“http://www.mywebsite.com”(用于通常的 SEO 目的)。

我正在运行 IIS7,但是站点前面有一个 ISA 服务器防火墙,这似乎(根据本文,尽管他的解决方案对我不起作用 - http://mrvirtual.de/2009/07/04/url-rewrite-through -isa-server-ends-in-a-loop/) 导致重写规则进入无限重定向循环。

DNS 由 Godaddy (TotalDNS) 管理。有没有办法配置 DNS 或域转发,以便我可以在到达 ISA 防火墙/IIS 之前完成重定向?这似乎比尝试追踪并修复 ISA、IIS 问题更容易(如果可能的话)(尽管如果有人有解决方案,我会接受)。

I have a website "mywebsite.com" and I would like to do a 301 redirect of "http://mywebsite.com" to "http://www.mywebsite.com" (for the usual SEO purposes).

I am running IIS7, however there is an ISA server firewall in front of the site, which seems (as per this article, though his solution did not work for me -- http://mrvirtual.de/2009/07/04/url-rewrite-through-isa-server-ends-in-a-loop/) to be causing the rewrite rule to go into an infinite redirect loop.

DNS is being managed by Godaddy (TotalDNS). Is there a way to configure DNS, or domain forwarding, so that I can accomplish the redirect prior to reaching the ISA firewall / IIS? This seems easier (if possible), than trying to track down and fix the ISA, IIS problem (though if someone has a solution for that, I'll take it).

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

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

发布评论

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

评论(5

薔薇婲 2024-08-09 07:08:54

“IIS 重定向到 www”的第一个结果:

http://www.xoc.net/作品/提示/domain.asp

First result for "IIS redirect to www":

http://www.xoc.net/works/tips/domain.asp

鹿童谣 2024-08-09 07:08:54

如果您使用 IIS7 并且使用 .Net 3.5(至少),恕我直言,最快的方法是将其快速添加到您的 web.config 文件中。

<system.webServer>
<rewrite>
<rules>
    <rule name="CanonicalHostNameRule1">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^www\.example\.com$" negate="true" />
        </conditions>
        <action type="Redirect" url="http://www.example.com/{R:1}" />
    </rule>
</rules>

注意:在这个例子中,它是从非 www url 到 www url

希望这对朋友有帮助。

If you are using IIS7 and you're using .Net 3.5 (at a minimum) the quickest way IMHO is to just quickly add this to your web.config file.

<system.webServer>
<rewrite>
<rules>
    <rule name="CanonicalHostNameRule1">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^www\.example\.com$" negate="true" />
        </conditions>
        <action type="Redirect" url="http://www.example.com/{R:1}" />
    </rule>
</rules>

Note: in this example its from a non www url to a www url

Hope this helps buddy.

青柠芒果 2024-08-09 07:08:54

我收回上面文章没有解决问题的说法。我只是没有尝试足够的变化。在 ISA 服务器策略的“收件人”选项卡、“此规则适用于此发布的网站”文本框中,我将字段从 www.mywebsite.com(这就是它在 IIS 中的列出方式)更改为 MyWebsite...看来我可以将其设为任何文本字符串,只要它不是重定向中使用的实际站点的名称(mysite.com 和 www.mysite.com 都会导致无限循环)。按照上面的方法修改一下,问题就解决了。感谢麦克兰德的轻推。 – 基因 0 秒前

I retract my statement that the article above did not solve the problem. I just didn't try enough variations. In the ISA server policies, "To" tab, "This rule applies to this published website" textbox, I changed the field from www.mywebsite.com -- which is how it is listed in IIS) to just be MyWebsite... it appears that I could make this any text string, as long as it is not the name of the actual site as used in the redirect (both mysite.com & www.mysite.com caused the infinite loop). Changed it as described above and problem solved. Thanks for the nudge mcandre. – Gene 0 secs ago

戏蝶舞 2024-08-09 07:08:54

如果您正在 ASP NET 上进行开发,那么您可以使用全局 asax 的 application_beginrequest 事件来应用一个简单的修复

这里有详细的解释
http://www.xaviermorera.com/2010/01/fix-canonical-redirect-issue-on-asp-net-in-a-shared-host-rackspacecloud/

If you are developing on ASP NET, then there is a simple fix that you can apply by using the application_beginrequest event of the global asax

Here is a detailed explanation
http://www.xaviermorera.com/2010/01/fix-canonical-redirect-issue-on-asp-net-in-a-shared-host-rackspacecloud/

苍暮颜 2024-08-09 07:08:54

为什么要尝试复杂的事情?只需尝试使用以下文件名 .htacces 的代码并将其上传到网站主机服务器 (public_html) 的根文件夹中。

RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/?$ "http://example.com/" [R=301,L]

Why do try complex things? Just try the below code with the filename .htacces and upload in the root folder of your website host server (public_html).

RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/?$ "http://example.com/" [R=301,L]

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