在网站的链接和重定向SSL和相对URL [英] SSL and relative URLs in site links and redirections
问题描述
我一直在测试阶段的网站有一段时间了,现在,我终于即将启动。有几个链接,锚标记,以链接到网站的管理员和车段在整个网站的相对URL,而现在他们必须SSL安全。
I have been working on a website in beta phase for some time now, and am finally about to launch it. There are several links, anchor tags, with relative URLs throughout the site that link to the admin and cart sections of the website, and now they have to be SSL secured.
此外,在的Response.Redirect(〜/../..\");
当用户浏览过 HTTP
,反正是有使用到重定向到与 HTTPS
连接页面相对URL?这似乎是惯例差为SSL目的链接和重定向code绝对URL。如果域名的变化,我不得不重写他们。另外,如果我想让他们在我的本地工作,我会在每次我上传到服务器时更改它们。必须有一些解决方案。
When a user is browsing over http
, is there anyway to redirect them to a page with https
connection using a relative URL? It seems like poor practice to code absolute URLs for links and redirections for the purpose of SSL. If the domain name changes, I have to rewrite them all. Plus, if I want them to work on my localhost, I would have to change them every time I upload to server. There must be some solution.
推荐答案
的之间切换HTTP和HTTPS自动是一个非常好的code用于切换逻辑快速和容易的实现 - 而不是改变现有code
Switching Between HTTP and HTTPS Automatically is a very good code to use for the implementation of switching logic fast and easy - and not change your existing code.
相似:<一href=\"http://stackoverflow.com/questions/9581582/$p$pparing-my-asp-net-mvc-site-to-use-ssl\">$p$pparing我的ASP.NET / MVC站点使用SSL?
这篇关于在网站的链接和重定向SSL和相对URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!