[英]301 redirect multiple Domains to a sub directories of a domain IIS
In IIS 7 how to do 301 redirect of Multiple domains to sub directories for the following 在IIS 7中,如何执行以下操作301将多个域重定向到子目录
Request Redirect to
--------------------------------------------------------------------------
www.domain.fr www.newdomain.com/fr/
www.domain.com.pk www.newdomain.com/pk/
www.domain.co.th www.newdomain.com/th/
www.xyzdomain.com www.newdomain.com/xyz/
I have many domains redirect to one single website in IIS and from where I have to redirect them to their relevant sub directories keeping 301 redirect (SEO Friendly) 我有许多域重定向到IIS中的一个网站,并且我必须从那里将它们重定向到保持301重定向的相关子目录(对SEO友好)
Appreciate your help, if anyone knows. 如果有人知道,请感谢您的帮助。
I found another way around for 301 redirects, it's like this: 我发现了301重定向的另一种方法,就像这样:
Put all your web domain to a single IIS Site. 将您的所有Web域都放在一个IIS站点中。 (the first Site) (eg www.domain.fr, www.domain.com.pk, www.domain.co.th, www.xyzdomain.com)
(第一个网站)(例如www.domain.fr,www.domain.com.pk,www.domain.co.th,www.xyzdomain.com)
Make another IIS Site for the main website (the second Site) (eg www.newdomain.com) 为主网站(第二个网站)制作另一个IIS网站(例如www.newdomain.com)
Now put an asp / php / asp.net code for redirecting based on the conditions you have, in my case i used asp classic and put some code like this: 现在根据您的条件放置一个用于重定向的asp / php / asp.net代码,在我的情况下,我使用了asp classic并放置了一些如下代码:
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("www.domain.fr") ) > 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.newdomain.com/fr/"
Response.End
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("www.domain.com.pk") ) > 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.newdomain.com/pk/"
Response.End
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.