问题描述
我想创建一个相对链接,将当前协议从 http 切换为 https 。我工作的最后一个地方在服务器上安装了一些东西,以便你可以实现这一点,但我不记得太多,我从来不知道它是如何工作的。
I would like to create a relative link that switches the current protocol from http to https. The last place I worked had something set up on the server so that you could make that happen, but I don't remember much about it and I never knew how it worked.
这样做的理由是我不需要在需要在生产环境和开发环境之间移动的文件中硬编码服务器名称。
The rationale for this is that I wouldn't need to hardcode server names in files that need to move in between production and development environments.
有没有办法这在IIS 6.0中工作?
Is there a way for this to work in IIS 6.0?
编辑:
我正在使用.NET,但我正在创建的链接不会动态生成。如果你真的想要细节,我在Umbraco中使用一个需要传入URL的重定向宏。
I am using .NET, but the "link" I'm creating will not be dynamically generated. If you really want the nitty gritty details, I am using a redirect macro in Umbraco that requires a URL to be passed in.
推荐答案
我们最终购买了ISAPI Rewrite,以便在某些URL的Web服务器级别执行重定向。当我提出问题时,这并不是我想要的答案,但这对我们有用。
We ended up buying ISAPI Rewrite to perform redirects at the web server level for certain URLs. That's not quite the answer I was looking for when I asked the question, but it's what works for us.
这篇关于使用相对URL切换到SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!