#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    181
    Rep Power
    11

    Htaccess force https but ignore addons?


    i've got https://www. being forced via:

    Code:
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.domain.com/$1 [R,L]
    and that seems to force http://domain.com to https://www.domain.com (which is what i want as the ssl cert is www)

    but i've got a couple of (cpanel) addon domains and the cert obviously doesn't work for them and flags up errors

    what's the best way of ensuring that: domain.com and www.domain.com are turned to http://www.domain.com
    BUT domain1.com and domain2.com are ignored?


    thanks in advance
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,070
    Rep Power
    9398
    Add in a RewriteCond that checks the hostname.
    Code:
    RewriteCond %{HTTP_HOST} ^((www.)?domain.com)$

    Comments on this post

    • bs7 agrees : thank you

IMN logo majestic logo threadwatch logo seochat tools logo