转发http://mydomain.com/ctrlr/act/val到http://WWW.mydomain.com/ctrlr/act/val [英] Forwarding http://mydomain.com/ctrlr/act/val to http://WWW.mydomain.com/ctrlr/act/val

查看:100
本文介绍了转发http://mydomain.com/ctrlr/act/val到http://WWW.mydomain.com/ctrlr/act/val的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写在ASP.NET MVC(V 1.0)的应用程序。该应用程序运行在IIS7和DNS是由GoDaddy的提供。

I have an application written on ASP.NET MVC (V 1.0). The application runs on IIS7 and the DNS is provided by GoDaddy.

我想转发来自 http://mydomain.com/ctrlr/act/任何请求值这种形式的网址: http://WWW.mydomain.com/ctrlr / ACT /值

I would like to forward any request that comes from http://mydomain.com/ctrlr/act/value to a URL of this form: http://WWW.mydomain.com/ctrlr/act/value

基本上,我想WWW添加到主机名,如果有人试图达到 http://mydomain.com

Basically, I want to add WWW to the Host-name if someone tries to reach http://mydomain.com

什么是做到这一点的最好方法是什么?

What would be the best way to do this?

推荐答案

我想你会发现,从适合回答这个<一个href=\"http://stackoverflow.com/questions/521804/how-to-redirect-with-www-urls-to-without-www-urls-or-vice-versa\">question

I think you will find an answer that suits from this question

我要和你强制使用了WWW的想法一致,仿佛于是决定的使用我相信扭捏作饼干性能和不必使用sstatic.net代替images.stackoverflow.com说,当他们感到遗憾的。

I would agree with your idea of forcing the use off www, as though SO decided to use it I do believe they regretted when tweaking performance for cookies and having to use sstatic.net instead of images.stackoverflow.com say.

要保存你在这里重定向是你需要做的要点。

To save you a redirect here is gist of what you need to do.

这里的IIS7规则到WWW preFIX添加到所有传入的URL。剪切此XML片段粘贴到下

Here’s the IIS7 rule to add the WWW prefix to all incoming URLs. Cut and paste this XML fragment into your web.config file under

<system.webServer> / <rewrite> / <rules>


<rule name="Add WWW prefix" >
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain\.com" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:1}"
    redirectType="Permanent" />
</rule>

这篇关于转发http://mydomain.com/ctrlr/act/val到http://WWW.mydomain.com/ctrlr/act/val的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆