Reputation: 13175
I have a site with an SSL cert for www.foo.com. What is the cleanest way redirect requests to the https:// prefix? Do I have to build links server side instead of relying on resolving urls with relative paths, ~/?
Also, say I redirect to an https:// page, the links on the page are all created in a master page and are resolved with relative paths. If the user clicks on any of the navigation elements they are essentially stuck on the https:// path, what is the best way to clean that up?
The paths all need to work in the dev (localhost), staging, and production environments.
Upvotes: 0
Views: 433
Reputation: 39916
No you dont need to do anything,
Unless you issue a fully qualified url, your every relative url redirects and paths are always considered along with https:// for example,
Your url of page is https://mysite/folder1/page.aspx and if you issue Response.Redirect("/folder2/page2.aspx") then web server only issues relative url "/folder2/page2.aspx" but the client (IE/FF2/Safari) they append "https://mysite" before the url.
So as long as you use relative urls in your project, you are safe.
Upvotes: 1
Reputation: 250942
You can set the <base> tag in your html, which would mean everything would then be relative to that base url.
Upvotes: 0