HostMonster Web Hosting Help

Wildcard SSL Certificates

Overview

This article will show you how to use your WildCard SSL Certificate, on your HostMonster hosting account, using mod_rewrite. This is required due to a limitation in WHM that only allows there to be one virtualhost entry.

Tasks Involved



Folder Structure

The subdomain must be assigned to a folder that is underneath the folder its parent domain is assigned to.
Example: Say you have a wildcard SSL certificate for example.com. Example.com is assigned to the public_html folder. I want to use my certificate on sub.example.com. In this case sub.example.com should be assigned to public_html/sub/ because sub is a directory underneath public_html.

Accessing the .htaccess File

The .htaccess file is located in the public_html folder. While you can use an FTP or an SSH client to access the file, for this article we will be using the File Manger.

  1. Login to your HostMonster cPanel
  2. Click the "File Manager", located in the Files section of the cPanel.
    File Manager
  3. Choose to open the "Web Root (public_html/www)"
    Web Root

    Be sure to check the box "Show Hidden Files (dotfiles)."

    Show Hidden Files
  4. Right click the .htaccess file and choose "Edit" or "Code Edit
  5. For basic HTML sites follow the instructions under Generic mod_rewrite Rule and copy the code into the Editor. If you have a WordPress, Joomla or Drupal site follow the instructions under WordPress/Joomla/Drupal mod_rewrite Rule.
  6. Click Save Changes.

Generic mod_rewrite Rule

If you have a basic HTML site copy the following text into your public_html/.htaccess file.
Note: You should not use this if you have a WordPress, Joomla or Drupal site. Use the instructions under WordPress/Joomla/Drupal mod_rewrite Rule instead.

You will need to replace subdomain with your subdomain and example.com with your domain name.


        # HostMonster.com
        #.htaccess WildCard SSL
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^subdomain.example.com$
        RewriteCond %{REQUEST_URI} !^/subfolder/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /subfolder/$1
        RewriteCond %{HTTP_HOST} ^subdomain.example.com$
        RewriteRule ^(/)?$ subfolder/index.php [L]
            

Once you have modified this code you may need to clear your browser cache to be able to see the redirect.

WordPress/Joomla/Drupal mod_rewrite Rule

For WordPress, Joomla or Drupal sites copy the following code:

If Just The Subdomain Holds either a WordPress, Joomla, or Drupal Site

If your subdomain holds either a WordPress, Joomla, or Drupal site but the parent domain does not, copy the following code.

You will need to replace subdomain with your subdomain and example.com with your domain name.

        # Custom subdomain .htaccess SSL + WordPress
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$
        RewriteCond %{REQUEST_URI} !^/subfolder/
        RewriteRule ^(.*)$ /subfolder/$1
        RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$
        RewriteRule ^(/)?$ subfolder/index.php [L]
        # End custom subdomain .htaccess
              

If The Parent Domain and The Subdomain Have WordPress Sites

If both the parent domain and the subdomain have either a WordPress, Joomla, or Drupal site copy the following code into your .htaccess file.

You will need to replace subdomain with your subdomain and example.com with your domain name.

        # Custom subdomain .htaccess SSL + WordPress
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$
        RewriteCond %{REQUEST_URI} !^/subfolder/
        RewriteRule ^(.*)$ /subfolder/$1
        RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$
        RewriteRule ^(/)?$ subfolder/index.php [L]
        # End custom subdomain .htaccess
        
        # Custom maindomain .htaccess WordPress
        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$
        RewriteRule ^index\.php$ - [L]
        RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        # End custom maindomain .htaccess
              

You may need to clear your browser cache for the new rules to work. After that your Wildcard SSL certificate should be working.

Knowledgebase Article 47,463 views bookmark tags: htaccess reseller ssl subdomain subfolder wildcard (updated 43 days ago)


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

How to renew an existing SSL certificate--or purchase a new one, within your cPanel (updated 213 days ago)
Knowledgebase Article 58,477 views tags: cert certificate layer secure security socket ssl

Do you support wildcard subdomains or wildcard DNS entries? (updated 1069 days ago)
Knowledgebase Article 87,993 views tags: dns domain subdomain wildcard zone

What files do you need to make your SSL certificate work on another account/server? (updated 1327 days ago)
Knowledgebase Article 28,500 views tags: certificate move ssl

Related Help Content

How to add a new SSL certificate for your different WM services. (updated 847 days ago)
Knowledgebase Article 24,945 views tags: ssl whm

I need to have an SSL 3rd Party Certificate installed for my domain. (updated 57 days ago)
Knowledgebase Article 159,711 views tags: certificate ssl

How do I use the free shared SSL Certificate? (updated 124 days ago)
Knowledgebase Article 247,272 views tags: certificate path shared ssl

How to reset the SSL certificates for your servers services (updated 530 days ago)
Knowledgebase Article 12,693 views tags: ssl whm

SSL/TLS Certificates and Addon Domains. (updated 866 days ago)
Knowledgebase Article 49,029 views tags: ssl

I need to have an SSL Self-Signed Certificate installed for my domain. (updated 124 days ago)
Knowledgebase Article 100,018 views tags: secure ssl

This article will show a way to protect specific pages of your website with SSL. This may have benefits for SEO and can be used on pages that contain forms, shopping carts or any other page where users might enter sensitive information. (updated 128 days ago)
Knowledgebase Article 2,343 views tags: htaccess pages specific ssl

Where do I get a copy of the site seal for my SSL I purchased through HostMonster? (updated 1130 days ago)
Knowledgebase Article 183,533 views tags: cert image logo seal secure ssl