问题描述
我看到写的胡言乱语很多类似的问题,我不明白:
我想知道如何使用微软的技术来做到这一点...或者只是为了我解释一下其他人都在谈论以及如何使用它们。
基本上,如果有人类型mydomain.com到地址栏,我想它解析为www.mydomain.com当页面加载完毕。
编辑:这是一个托管网站,所以我不能配置IIS服务器
- 非WWW到www重定向
- www.yourdomainname.com/default.aspx到www.yourdomainname.com
现在添加配置标记在web.config中
< system.webServer>
<&改写GT;
<规则与GT;
<规则名称=重定向到WWWstopProcessing =真>
<*匹配URL = />
<条件>
<添加输入={HTTP_HOST}模式=^ $ yourdomainname.com/>
&所述; /条件>
<作用TYPE =重定向URL =http://www.yourdomainname.com/{R:0}redirectType =永久/>
< /规则> <规则名称=默认文档stopProcessing =真>
<匹配URL =?(。*?)/默认\\ $的.aspx/>
<作用TYPE =重定向URL ={R:1} //>
< /规则>
< /规则>
< /重写>
< /system.webServer>
(或)与此一去:
<&改写GT;
< globalRules>
<规则名称=重定向到www.domain.compatternSyntax =ECMAScript的stopProcessing =真>
<*匹配URL = />
<条件logicalGrouping =MatchAny>
<添加输入={HTTP_HOST}模式=^ *域名(COM |网)$/>
<添加输入={HTTP_HOST}模式=?^(WWW)mydomain2(COM |网)$/>
<添加输入={HTTP_HOST}模式=^ $ www.domain.net/>
&所述; /条件>
<作用TYPE =重定向URL =http://www.domain.com/{R:0}/>
< /规则>
< / globalRules>
< /重写>
I see many similar questions written in gibberish that I don't understand:
- Redirecting non-www URL to www
- Redirecting URL without www to www
- Redirect Non-WWW to WWW URLs
- rewrite url to non www multiple sites
I'd like to know how to do this using Microsoft's technology ...or just explain to me what those others are talking about and how to use them.
Basically, if someone types "mydomain.com" into the address bar, I want it to resolve to "www.mydomain.com" when the page has finished loading.
EDIT: This is a hosted website, so I can't configure the IIS Server.
- Non www to www redirect
- www.yourdomainname.com/default.aspx to www.yourdomainname.com
Now add config tag in web.config
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yourdomainname.com$" />
</conditions>
<action type="Redirect" url="http://www.yourdomainname.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="Default Document" stopProcessing="true">
<match url="(.*?)/?default\.aspx$" />
<action type="Redirect" url="{R:1}/" />
</rule>
</rules>
</rewrite>
</system.webServer>
(or) Go with this one:
<rewrite>
<globalRules>
<rule name="Redirects to www.domain.com" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^domain.*(com|net)$" />
<add input="{HTTP_HOST}" pattern="^(www.)?mydomain2.(com|net)$" />
<add input="{HTTP_HOST}" pattern="^www.domain.net$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" />
</rule>
</globalRules>
</rewrite>
这篇关于附加在WWW网址为托管ASP站点(即没有IIS访问)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!