301从domain.com/default.aspx和其他网址重定向到domain.com [英] 301 redirect from domain.com/default.aspx and other urls to domain.com
问题描述
我有几个网址需要转移到域名。我已尝试通过代码,但我得到两个301重定向。
我的要求是简单地将URL重定向到域名。
I have several URLs which I need to transfer to domain name. I have tried through code but I am getting two 301 redirects.
My requirement is to simply redirect below URLs to domain.
http://domain.com/index.php
http://domain.com/index.htm
http://domain.com/index.html
http://domain.com/index.shtml
http://domain.com/index.asp
http://domain.com/default.asp
http://domain.com/default.aspx
http://domain.com/index.aspx
http://domain.com/index.cfm
http://domain.com/index.pl
http://domain.com/default.htm
当我尝试上面的URL时,他们给了我2 301重定向我只需要1 301 redirec
我可以通过IIS 7完成吗。
我尝试了什么:
when i tried the above URLS they give me 2 301 redirects I only need 1 301 redirec
Can I do through IIS 7.
What I have tried:
<rule name="default page" stopprocessing="true">
<match url="(.*)default.aspx$" />
<action type="Redirect" url="{R:1}" redirecttype="Permanent" />
</rule>
http://domain.com/index.php
301至
http://www.domain.com/index.php
然后再次301至
http:// www .domain.com
200 ok
http://domain.com/index.php
301 to
http://www.domain.com/index.php
and then again 301 to
http://www.domain.com
200 ok
推荐答案
/>
< action type =Redirecturl = {R:1}redirecttype =Permanent/>
< / rule>
" /> <action type="Redirect" url="{R:1}" redirecttype="Permanent" /> </rule>
http:// domain.com/index.php
301到
http://www.domain.com/index.php
然后又301 to
http://www.domain.com
ok ok
http://domain.com/index.php
301 to
http://www.domain.com/index.php
and then again 301 to
http://www.domain.com
200 ok
这篇关于301从domain.com/default.aspx和其他网址重定向到domain.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!