Https redirect help!

irvo

Guppy
As a relative novice I would be grateful for anyone who could provide me with a way of redirecting all traffic to my http url automatically to the same url but https. I have needed to install ssl for a new site. I have a Windows account using hsphere. Performing a google search provides lots of information relating to error codes and IIs but I wouldn't know where to start with that and there aren't any step by step guides as such. Certainly nothing that seems possible using Hsphere.
 
I'm sure there's a better way to do this with DNS settings but that's above my head. If you have ASP you can make a default.asp file with the following:

<%
response.redirect "https://yourserver.com"
%>
 
sorry, mis-read your question. if your site was done in asp you could make a simple function that checked the current url and then redirected to the https version. but you would have to add some asp to every page on the website.

lol, I'm sure there is a better way. just throwing this out there.
 
<if using ASP pages>

What about:

Code:
<%
   If Request.ServerVariables("SERVER_PORT")=80 Then
      Dim strSecureURL
      strSecureURL = "[URL="https://www.yousite.com/"]https://www.yousite.com[/URL]"
      ' strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
      strSecureURL = strSecureURL & Request.ServerVariables("URL")
      Response.Redirect strSecureURL
   End If
%>
 
Pretty much what I was thinking. although now that I think about it, wouldn't it be better to use Transfer instead of redirect so that any submitted form data would also be carried over?

Also, even if your not using ASP, I'm sure you can do something similar in PHP or whatever you are using. I assume your using a script language since you're using a https.
 
Thanks guys. Yes, I'm using asp. I already use a scripted 404 error and was hoping to do something similar for the 403 error thrown up by the http request. I'll give your code a try.
 
Back
Top