Welcome to Centmin Mod Community
Become a Member

Wordpress Wordpress install doesn't redirect http to https

Discussion in 'Blogs & CMS usage' started by gabel, Apr 22, 2020.

  1. gabel

    gabel Member

    68
    38
    18
    Jan 7, 2016
    Ratings:
    +64
    Local Time:
    2:11 AM
    1.9.9
    MariaDB 10
    I just did a new WordPress install on a second IP which, all worked, but when I was going to Website Domains Names & Hosting | Domain.com was not redirected to https even though only wanted https. So HTTP was redirected to the default page while https was working fine.


    After a bit of headbanging had a quick look in .conf and I saw that in front of the 302 redirect to https there was an #x#. Removed that restarted and all fine. Not sure why it did that
    [​IMG]
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    11:11 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    How was Wordpress installed ? via centmin.sh menu option 22 ? or manually installed after running centmin.sh menu option 2 or nv cli commandline ?

    If you ran centmin.sh menu option 2 or 22, which letsencrypt option did you select from
    Code (Text):
    -------------------------------------------------------------
    Setup full Nginx vhost + Wordpress + WP Plugins
    -------------------------------------------------------------
    
    Enter vhost domain name you want to add (without www. prefix): acme3.domain1.com
    
    Create a self-signed SSL certificate Nginx vhost? [y/n]: n
    Get Letsencrypt SSL certificate Nginx vhost? [y/n]: y
    
    You have 4 options:
    1. issue staging test cert with HTTP + HTTPS
    2. issue staging test cert with HTTPS default
    3. issue live cert with HTTP + HTTPS
    4. issue live cert with HTTPS default
    Enter option number 1-4: 1
    

    only option 4 would give you HTTPS default live Letsencrypt SSL cert based site with automatic 302 non-HTTPS to HTTPS redirect. Option 3 would give you HTTPS + non-HTTPS site without a 302 non-HTTPS to HTTPS redirect in which case you manually need to set it up afterwards as per centminmod.com/nginx_domain_dns_setup.html#httpsredirect is the correct way to set it up - pay attention to different way if you want redirect target being www version instead of non-www and vice versa and that the target version www or non-www is the only version listed in server_name for the 2nd/main server {} context.
     
  3. gabel

    gabel Member

    68
    38
    18
    Jan 7, 2016
    Ratings:
    +64
    Local Time:
    2:11 AM
    1.9.9
    MariaDB 10
    Ups forgot to say that, used option 22 and selected 4 on letsencrypt.
     
  4. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    11:11 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    You can check the centmin.sh menu option 22 run's log for clues, you don't have to post it publicly as it would have sensitive info. But below is how you'd inspect and provide the log if you want. Or you can try a 2nd dummy centmin.sh menu option 22 run and see if that also had missing 302 redirect or not on a test VPS etc.

    Troubleshooting Centmin Mod Menu Option 22 Wordpress Install Run



    To troubleshoot centmin.sh menu option 22 wordpress installation, you need to check the centmin.sh menu option 22 log located in /root/centminlogs at /root/centminlogs/centminmod_*_wordpress_addvhost.log based log where * is the centminmod version and date timestamp. Edit and mask any actual ftp username/password or wordpress usernames and logins before posting the log contents to Pastebin.com or Gists to share a sanitised version of the contents of the log.

    Example list /root/centminlogs files in date ascending order and grep for wordpress_addvhost.log
    Code (Text):
    ls -lahrt /root/centminlogs | grep wordpress_addvhost.log
    

    example output returns log at /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_wordpress_addvhost.log
    Code (Text):
    ls -lahrt /root/centminlogs | grep wordpress_addvhost.log
    -rw-r--r--  1 root root 2.2M Oct 11 01:40 /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_wordpress_addvhost.log
    

    in SSH use cat to ouput contents of /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_wordpress_addvhost.log. Clear your SSH client window/buffer so only output is the contents of the file
    Code (Text):
    cat /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_wordpress_addvhost.log
    

    Then copy and paste into Pastebin.com or Gists entry. If your SSH window scroll buffer isn't that large to get the whole contents of the install log, you can download file manually and copy and paste contents. But makes sure it's sanitised version of the contents without revealing sensitive info. For example you can replace domain name of the wordpress site with generic dummy entry = domain.com if you want and mask site/server IP revealed in the log with generic dummy entry = 111.222.333.444.
     
  5. gabel

    gabel Member

    68
    38
    18
    Jan 7, 2016
    Ratings:
    +64
    Local Time:
    2:11 AM
    1.9.9
    MariaDB 10
    what's weird is that last night I added a new host on the same server (non-wp), same steps with SSL and everything and again it had that #x#. Using the latest beta build.