Wildcard Subdomain Http redirect to https

Hi,

I installed wordpress multisite and a wildcard certificate on the super admin domain. However, whenever I attempt to access a subdomain via http it redirect to to my main domain and not https of my subdomain.

How can I setup my wildcard subdomains so that when they are accessed via http they are automatically forwarded to https?

For an example:

Right now whenever I access the domain like this it automatically redirects to my super admin domain.

http://subdomain.mydomain.com --> https://mydomain.com

I want it so that it does this

http://subdomain.mydomain.com --> https://subdomain.mydomain.com

how is this done? Do I need to configure the .htaccess file or what?

Thank you!

  • Sajid

    Hi g0dzilla420,
    Hope you are doing good today :slight_smile:

    To solve the redirection of subsite to main site, please clear your browser cache and let us know if that solve the issue.

    Also if you could share the links of your website here, main domain as well as subdomain so I can take a closer look.

    To redirect main domain aswell as subdomain over HTTPS. Please add following code in .htaccess file.
    # BEGIN HTTPS

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>
    # END HTTPS

    Hope that helps! Feel free to post a reply if you need further assistance :slight_smile:

    Kind Regards,
    Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.