• Hi,

    I have 2 websites on a dedicated server and redirect works on one but not the other.
    When I type mydomain.com in the address bar (using Chrome, Fire and IE) it gets redirected to http://www.mydomain.com instead of https://www.mydomain.com
    Both websites under WordPress Address and Site Address URL have https://www.
    If I type htpps://mydoamin.com it rediirect just fine to https://www.mydomain.com
    I’ve been trying for days to understand why this site is doing this but no luck.

    Any suggestion is welcome!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Redirect from http to https should be automatic?

    It should be automatic but not all things are perfect.

    Try this: make a backup of your site’s database and files (backups are your friend).

    https://codex.www.ads-software.com/WordPress_Backups

    Then treat your site as if it moved from one URL to the other. In this case it’s https://www.mydomain.com to https://www.mydomain.com (http to https).

    https://codex.www.ads-software.com/Moving_WordPress#Changing_Your_Domain_Name_and_URLs

    After all of the old references are changed to the new one (with https) then the redirect should just work. If something goes wrong then restore the database and you’ll be back to where you were before you tried to make changes.

    https://codex.www.ads-software.com/Restoring_Your_Database_From_Backup

    Thread Starter JohnyBeGood

    (@johnybegood)

    Thanks for the reply!

    The site had already under WordPress Address and Site Address URL https://www.mydomain.com but when I type in the browser
    mydomain.com it does not get redirected to https://www.mydomain.com

    I even backed up and reinstalled WordPress and started installation process with https://www.mydomain.com and still no luck. Changed from https to http and then back to https and still no luck even tried with default Twenty Sixteen theme. What is causing to get stuck on https://www. ?

    • This reply was modified 8 years, 5 months ago by JohnyBeGood.
    • This reply was modified 8 years, 5 months ago by JohnyBeGood.
    • This reply was modified 8 years, 5 months ago by JohnyBeGood.

    There are two additional things I do to get HTTPS to work on a WordPress site when Jan’s recommendation doesn’t work:

    1. In your wp-config.php, add the following code:
      
      define('FORCE_SSL_ADMIN', true);
      
    2. Add the following at the beginning of the .htaccess file in your root WordPress folder:
      
      RewriteEngine On
      RewriteCond %{HTTPS} !=on
      RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
      

    Ordinarily, setting those in addition to the HTTPS in site URL and Address in General Settings do the trick.

    Thread Starter JohnyBeGood

    (@johnybegood)

    Thanks!

    I did as suggested above and now when I go to here https://www.linksspy.com/seo-tools/free-seo-ssl-scan/ and enter mydomain.com under “Your domain”
    I get this:

    https://mydomain.com
    There are the following errors for this URI:
    #
    description

    1 https://mydomain.com/ redirects to https://www.mydomain.com/ through a redirect chain. This hurts your rankings
    https://mydomain.com/ –>
    https://mydomain.com/ –>
    https://www.mydomain.com/

    which means its bad for SEO.

    I wouldn’t use the “www” subdomain in your site address or URL. It’s kind of a holdover from the old days when the web was new. Now it’s assumed that if you’re going to a domain, it’s a web site. Just use “https://yourdomain.com” for both the site and home settings as long as your SSL certificate supports it. Most SSL certs these days do. Test it again after making that change and you should be okay.

    I just checked one of my SSL sites on linksspy.com, and it had no errors, so I think you can get there with the settings I suggested.

    By the way, you’re going to need to make sure that all the links in your content, widgets, etc. as well as the src for images are set to HTTPS, or are protocol-neutral, too.

    • This reply was modified 8 years, 5 months ago by linux4me2.
    Thread Starter JohnyBeGood

    (@johnybegood)

    I got it to work! Thank you so much!

    Since google.com gets still forwarded to https://www.google.com I’m following them for now ??

    I did turn off auto redirect to www and in WordPress settings I already had https://www.mydomain.com

    With your .htaccess suggestion I changed from:
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    to
    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    now it gets redirected from mydomain.com to https://www.mydomain.com
    And the best part is linksspy.com is not finding any errors!

    All of my images are https and every link I visit I get green pad lock.

    It still blows my mind why other domain I did not had to do any of this. It just works out of box.
    Oh well, I’ve been trying to get this to work for days now and I’m glad its working.

    Thanks again!

    • This reply was modified 8 years, 5 months ago by JohnyBeGood. Reason: edit
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Redirect from http to https should be automatic?’ is closed to new replies.