Learn about Centmin Mod LEMP Stack today
Register Now

Need Help With Redirect Chains https www

Discussion in 'Blogs & CMS usage' started by UsmanGTA, Jun 22, 2018.

  1. UsmanGTA

    UsmanGTA New Member

    11
    2
    3
    Sep 14, 2017
    Ratings:
    +2
    Local Time:
    8:02 PM
    Hi Centmin Community,

    Ever since I installed centmin, I delighted when it comes to speed tests. However, I have noticed that the move to https has messed up with Google's rankings. It has been seven months since and I am still waiting for it to be fixed. I was recommended to look at a redirect chain that my website has. I'm looking to remove it and make it much simper. Could you help me?

    When I installed Wordpress with Option 24 I had LetsEncrypt=Y in my custom config as well as used geeksultd.com (without www.) at the time of Wordpress installation.

    What do I edit here? The current redirect chain is as follows
    Home
    Home
    Home

    My wordpress site address and url address is Home

    I want to make it redirect from Home to Home

    I'm not sure which Nginx file is necessary to edit, but here's one of the portions I picked up from
    /usr/local/nginx/conf/conf.d/geeksultd.com.ssl.conf

    #x# HTTPS-DEFAULT
    server {

    server_name geeksultd.com www.geeksultd.com;
    return 302 https://geeksultd.com$request_uri;
    include /usr/local/nginx/conf/staticfiles.conf;
    }

    server {
    listen 443 ssl http2;
    server_name geeksultd.com www.geeksultd.com;

    include /usr/local/nginx/conf/ssl/geeksultd.com/geeksultd.com.crt.key.conf;
    include /usr/local/nginx/conf/ssl_include.conf;

    Any help would be greatly appreciated.

    THANKS
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,884
    8,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,435
    Local Time:
    10:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Posted at 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.

    key to testing is using 302 temp redirect first in a private incognito browser session otherwise the problems you can experience may end up being due to browser caching or 301 permanent redirects unless you clear browser cache and reboot local computer(s) and even then some web browsers don't let go of 301 permanent redirect browser cache that willingly :)

    You can test in SSH via curl to check headers for location field (where the redirect goes) using the following commands:
    Code (Text):
    curl -I http://domain.com
    

    Code (Text):
    curl -I http://www.domain.com
    
     
..