0

I have a wordpress site on main.com and a second one on blog.main.com

main.com already had an ssl certificate working.

In cPanel I installed a new wildcard ssl certificate intended for '*.main.com'

(sorry, apparently i don't have enough reputation to post more than 2 links)

At this point: https main.com was continuing to function properly.

http blog.main.com was still working.

https blog.main.com was redirecting to https main.com

So the blog needs more work.

I changed the wordpress site-url and site-address of the blog to 'https://blog.main.com'.

And I changed the .htaccess of the blog and added 3 lines on top:

RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Now: https blog.main.com still redirects to https main.com.

http blog.main.com also redirects to https main.com.

(Changing the site-url and address and the .htaccess back, doesn't reverse the redirect.)

The only redirect in cPanel is 403 for '.(htaccess|htpasswd|errordocs|logs)$'

edit: Note that mail.main.com is also redirecting the main.com.

What could be causing the blog to redirect to the main site.

  • I got the same problem in siteground with lets encrypting. For me the solution was leave the wildcard.. and make SSL for each domain or sub domain – ccdiego5 Jul 7 at 17:54
0

Change your first 3 lines of your .htaccess to the follow. the code needs to go into the apache IfModule mod_rewrite

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
  • I changed it but it's still redirecting. – Dan1ell Jul 27 '17 at 19:23
  • have you changed in all wp builds? also double check your WordPress Address (URL) and Site Address (URL) in both sites, you should have https in both url addresses – Nuno Sarmento Jul 27 '17 at 19:26
  • For the main site i can see in settings that it is set to https. For the blog i can see in the database that siteurl and home are set to https. – Dan1ell Jul 27 '17 at 19:37
  • The blog only has 4 plugins that dont look like the cause (use-any-font, akismet, jetpack, font-organizer). But is it possible for a plugin in the main site to cause the blog to redirect to it? – Dan1ell Jul 27 '17 at 19:40
  • Disable all plugins and run Twenty theme and see how it behaves – Nuno Sarmento Jul 27 '17 at 19:54
0

I'll leave this question up in case it helps someone. But the answer turns out to be that the certificate wasn't installed on the subdomain.

When checking for a certificate with the ssl checker on https://decoder.link/sslchecker, it looked like it was installed on both main and the subdomain. (Tech support showed me this, so I didn't doubt it. I looked for the problem everywhere but there.)

Turns out, the redirection was causing the certificate to be shown for the subdomain. The certificate was only installed on the main site. (A different tech support person pointed this out.)

Not mad at anybody. Both techs were great and helped me plenty. This was just a small oversight.

Maybe this helps somebody.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.