Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Filter out www out of subdomain

Discussion in 'Bind / DNS / Nameserver Issues' started by mindofmedia, Dec 12, 2017.

  1. mindofmedia

    mindofmedia Registered

    Joined:
    Feb 1, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    I have a website called example.com it's a WordPress multi site where a SSL certificate is installed.

    But I also have server subdomain on that domain (the other sites in the multi site) but without SSL certificate.

    Right now it is configured that when you go to example.com that you will be forced to use the SSL connection.
    The subdomain doesn't have that requirement. But when a visitors goes to https:// subdomain. example.com it will get a SSL waring (as you can expect).
    Also when you would go www.subdomain.example.com you will get redirected to wp-signup .php

    Is there anyway to we can all prevent this?
    So if I go https://subdomain.example.com I will be redirected to http:// subdomain. example.com
    and
    if I go to https or http http://www.subdomain.example.com I will go to http:// subdomain. example.com

    But since it is a multi site it must be something general, because if we create a new site (= a new subdomain) also that site needs to that.

    Here is my current htaccess file
    Code:
    RewriteCond %{HTTP_HOST} ^example.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress
     
    #1 mindofmedia, Dec 12, 2017
    Last edited by a moderator: Dec 13, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,802
    Likes Received:
    1,714
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    One approach is to ensure a SSL certificate is installed for each subdomain. The following thread includes a workaround you may find helpful:

    SOLVED - AutoSSL and WordPress Multisite

    Thank you.
     
Loading...

Share This Page