从旧网站redirect到不同文件夹上的新网站

我想redirect所有请求从一个URL主机www.hostname1.com(包括所有subdirectores-www.hostname1.com / ….)到一个不同的主机,不同的urlwww.newHost.com。 我已经在DNS中进行了更改,但是我想知道在www.newHost.com托pipe的服务器上应该做什么更改,以便在浏览器上显示新的URL时进行redirect。

我看看IIS。 在www.newHost.com的configuration下,我可以将www.hostname1.com绑定到与www.newHost.com相同的IP地址,但是这只适用于www.hostname1.com的主页,并且不会重写URL地址浏览器窗口。

请告知如何进行此更改。

在新的服务器上,在www.hostname1.com站点下(在新服务器上创build的站点,在DNS更改之后捕获到旧站点的stream量),将其用作整个web.config文件。

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="301 redirect entire site" stopProcessing="true"> <match url="^(.*)$" /> <action type="Redirect" redirectType="Permanent" url="http://www.newhost.com/{R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration> 

这将创build一个重写规则,抓取整个URL的内容( http://www.hostname1.com/之&#x540E; ),把“ http://www.newhost.com/ ”放在它的前面,任何查询string最后,将浏览器redirect到该URL。 这是一个301redirect(永久),所以它应该是SEO安全,所以谷歌不会惩罚你的排名。 我没有testing过,但我认为它应该适合你。