Forwarding http to https

Discussion in 'Mac OS X Server, Xserve, and Networking' started by CorporateFelon, Jun 15, 2010.

  1. CorporateFelon macrumors regular


    Oct 26, 2007
    Boston, MA
    I haven't found anything in Server Admin yet, and have yet to read up on the documentation, but I cant seem to find a simple way to set up a site to automatically forward a user to https if they try to connect via http.

    My work around is to have a duplicate site set up on port 80 pointing at a directory only containing an .htaccess file that automatically redirects all requests to the https version. This simple solution works quite well, but I'd prefer a more controllable method.

    Any one know if what I am trying to accomplish is easily done in the Server Admin?
  2. angelwatt Moderator emeritus


    Aug 16, 2005
    Using a .htaccess file is the way I always see used for this.
  3. CANEHDN macrumors 6502a


    Dec 12, 2005
    Eagle Mountain, UT
  4. bartzilla macrumors 6502a

    Aug 11, 2008
    A simple way if your users are just hitting a landing page (e.g. they're typing '' into their browser and ending up at "" where you want them to be at "" is to just have a default document that contains a simple meta redirect. Simple, dirty, not at all "robust" but sometimes its good enough, you know?
  5. ulbador macrumors 68000


    Feb 11, 2010
    Mod Rewrite

    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1
  6. CANEHDN macrumors 6502a


    Dec 12, 2005
    Eagle Mountain, UT
    The only downside to this is you would get an infinite loop if you're trying to redirect to the same page. to the page would continually redirect if using simple html. You'd need a scripting language PHP or something to check the domain to see if it needs to redirect.
  7. ruud macrumors regular

    Jul 1, 2004
    You can do this entirely from within Server Admin.

    Set up 2 sites, one on port 80, and one on port 443 with SSL enabled.

    On the site on port 80, go to the Aliases tab and in the second pane, add a redirect as follows:
    type: redirect
    pattern: /

Share This Page