我有一个网站在IIS 7.5上运行,自动redirect从“ http://mysite.com/whatever.aspx ”到“ http://www.mysite.com/whatever.aspx ”
在该网站上,我想redirect到首页index.aspx的旧url有很多stream量:' http : //mysite.com/foo/bar/index.cgi%something=asdf&somethingelse=qwerty “
问题是,无论我尝试什么,我只能得到redirect工作与www子域。 如果我使用的url没有www,我只是最终在' http://www.mysite.com/404.aspx '
有任何想法吗? 在此先感谢您的帮助!
编辑3:好像浏览器caching的redirect响应搞乱了我,所以编辑2是错误的。 请参阅下面的回复。
编辑2:忽略编辑1,它似乎并不像它的工作。
编辑:这里有一些进一步的信息:使用这篇文章我已经设法redirect从“ http://mysite.com/foo/bar/index.cgi ”到“ http://www.mysite.com/index.aspx ” ,但如果我添加查询string参数,它仍然redirect到“ http://www.mysite.com/404.aspx ”
没有办法来捕获所有的请求到CGI文件,包括查询string参数?
所以,我设法按照以下方式进行工作:
1)将子目录/ foo / bar添加到IIS中的应用程序
2)在子目录中添加文件index.cgi
3)在子目录中创build以下webconfig:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent"> <add wildcard="*.cgi*" destination="http://www.mysite.com/index.aspx" /> </httpRedirect> </system.webServer> </configuration>
这抓住了所有对index.cgi的请求,但这对我很有用。 我可能已经得到它只与我指定的URL,但它不需要。