Set Up An HTTP to HTTPS Redirect RRS feed

  • Question

  • I have been using Expression Web 4 for a number of years. I now need to setup a "http to https redirect" but I have not found an information on how to do it. Can anyone help?

    Dennis K

    Saturday, January 25, 2020 8:35 PM

All replies

  • I think (hoping) that just might be JavaScript...

    Window open() Method

    George Frias - AWWshop @ Wikidot, Wiki1978

    Saturday, January 25, 2020 8:54 PM
  • What kind of site is it (, static html?) and what kind of server do you publish to?

    If it's and the server has the rewrite module installed, you can do it in the web.config. Otherwise you have different options, and they vary by what kind of server you are publishing to

    You may be able to do this in your hosting account panel.

    Whichever you do, this is not an EW thing (other than you can edit the web.config in EW, if that's your option).

    Kathleen Wilber
    BrightWillow - Asp.Net Applications

    • Edited by KathyW2 Sunday, January 26, 2020 2:36 AM
    Saturday, January 25, 2020 11:15 PM
  • George, Opening a new window does not detect http and move it to https, and not do that if it's already https.

    Kathleen Wilber
    BrightWillow - Asp.Net Applications

    • Edited by KathyW2 Saturday, January 25, 2020 11:18 PM
    Saturday, January 25, 2020 11:17 PM
  • if ( window.location.protocol != 'https:' ) { window.location.href.replace( 'http:', 'https:' ) ); }

    George Frias - AWWshop @ Wikidot, Wiki1978

    Sunday, January 26, 2020 6:16 AM
  • George, you'd have to put that in every page.  A server based general redirect is a better option: it applies to all pages and any new pages you add later.  A server based solution also allows the redirect to be set as permanent, which is important for search results.

    Kathleen Wilber
    BrightWillow - Asp.Net Applications

    Sunday, January 26, 2020 6:50 AM
  • Yes, you are right.

    It even brings up the question whether or not HTML files should start with a JavaScript include (or have it inserted right after the title) so that async resources and things like that can go first?

    You got me going bananas here.

    George Frias - AWWshop @ Wikidot, Wiki1978

    Sunday, January 26, 2020 10:06 AM
  • I just went (for the first time) the process of purchasing a secure certificate and installing it on my website. I bought the certificate via Namecheap and I discovered in the process that their chat support and their knowledge base was very good at assisting me through the process.

    After installing the certificate on my website (using the website control panel at my host), I successfully secured my site, but then had the problem the users coming in with just an http: address would not automatically be directed to the https address. I don't know if this will help you, but the problem was solved for the entire site by placing this code in my web.config file:


     <!--begin section that redirects to https-->
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
              <match url="(.*)" />
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
              <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
        <!--end section redirecting to https-->


    ClarkNK AKA HomePage Doctor
    Database Tutorials Using ASP.NET Controls
    My recommended web hosting company: RDOServers

    Tuesday, January 28, 2020 4:33 PM
  • Clark,

    There was a reason I asked iamclueless2016 what type of site this is, and what OS it is hosted on.  We haven't heard back from the OP.

    Web.configs work for sites hosted on Windows in an account that supports Asp.Net.

    There are different answers otherwise.

    Kathleen Wilber
    BrightWillow - Asp.Net Applications

    Tuesday, January 28, 2020 8:22 PM
  • In my case GoDaddy has a switch that I can ensure all traffic is redirected to HTTPS.

    I would not be surprised if your hosting provider has something similar.

    George Frias - AWWshop @ Wikidot, Wiki1978

    Tuesday, January 28, 2020 8:55 PM
  • Yes, as I said in my first post:  "You may be able to do this in your hosting account panel."

    Kathleen Wilber
    BrightWillow - Asp.Net Applications

    Wednesday, January 29, 2020 2:26 AM
  • You know what? It was not for HTTPS, it was for www.

    George Frias - AWWshop @ Wikidot, Wiki1978

    Wednesday, January 29, 2020 2:37 AM
  • I apologize that I did not respond immediately. I’ve been traveling. I’m a financial consultant, and am truly clueless about this web issue.

    Years ago, I used Microsoft Expression Web 4 (EW4) to build my website. The website is hosted on Network Solutions (NS). NS told me that they do not technically support “Windows Based” websites. I would have to use a paid service to get help.

    I don’t know what a “web.config” file is. The files I upload using EW4 do not include a “web.config” file.

    Also, I don’t know how to determine whether site is or static.html.

    The files that upload are:

    1.       A number of page files all ending in .htm.
    2.       An images folder with .jpg and .gif files.
    3.       A styles folder which includes “layout.css” and “style2.css”.
    4.       A file “Home.htm”.
    5.       A file “master.dwt”.

    These files do not include a “web.config” file.

    I’ve searched the web for info, but no instance address the solution in terms of EW4. There are suggested strings of commands to redirect “www” and “http” to “https”, but no specific example of how to implement using EW4.

    The Network Solutions rep suggested that I rebuild my website using their web building application. That is a non starter. There must be a ready and easy solution.

    Wednesday, January 29, 2020 4:29 PM
  • If you only have one page/file then add this somewhere after <title>

    if ( window.location.protocol != 'https:' ) { window.location.href.replace( 'http:', 'https:' ) ); }

    If you have many htm files, you can add reference to the JavaScript file similar in the way you reference css. Something like this:

    <script src="/script/anchor.min.js"></script>

    George Frias - AWWshop @ Wikidot, Wiki1978

    Wednesday, January 29, 2020 5:12 PM