1

I have recently enabled SSL certificate and I'm tring to use it in my wordpress site. My website's url is


All plugings are disabled.


I replaced

 define('WP_HOME','http://mywebsite.com');   
 define('WP_SITEURL','http://mywebsite.com');

with:

define('WP_HOME','https://mywebsite.com');
define('WP_SITEURL','https://mywebsite.com');

Here's what I get in http://www.redirect-checker.org:

301 Moved Permanently https://mywebsite.com/ 301 Moved Permanently https://mywebsite.com/ 301 Moved Permanently https://mywebsite.com/ 301 Moved Permanently

Problems found: Too many redirects. Please try to reduce your number of redirects for https://mywebsite.com. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.


A simple .txt file is working ok with https. For example:

https://mywebsite.com/license.txt

gives "200 OK" message and page is browsed via https normally.

But trying to browse .index.php (which includes wordpress) is giving "too many redirects" error.


I tried adding redirects to .htacess file but didn't work. I have read many articles about this issu but haven't managed to solve it. Can you help me please?


UPDATE

Here are the _SERVER variables, shown by phpinfo()

_SERVER["UNIQUE_ID"]    WkOCLwoADAIAAFpxjJQAAAAG
_SERVER["QS_SrvConn"]   290
_SERVER["QS_AllConn"]   290
_SERVER["QS_ConnectionId"]  15143736798377620623491
_SERVER["HTTPS"]    1
_SERVER["HOME"] /home10a/sub002/sc11808-TCBG
_SERVER["HTTP_HOST"]    mywebsite.com
_SERVER["HTTP_USER_AGENT"]  Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
_SERVER["HTTP_UPGRADE_INSECURE_REQUESTS"]   1
_SERVER["HTTP_ACCEPT"]  text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate, br
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-US,en;q=0.9,el;q=0.8
_SERVER["HTTP_COOKIE"]  wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_dbdaedf581c00cfca1e0c4de7c421d21=marketing%7C1514545975%7C91BD7fgU1i2AZl6rYQQ1cjIFfYkG2raYJp0VNXAIEHM%7C9a9f559abd4e30c57834d12a093683a1b6ff5dff14fbbf341983e1acee2fef58; wp-settings-3=mfold%3Do%26editor%3Dtinymce%26libraryContent%3Dbrowse%26galleryitemtype_tab%3Dpop%26hidetb%3D1%26wplink%3D0%26posts_list_mode%3Dlist%26imgsize%3Dfull; wp-settings-time-3=1514373177; redux_blast=1514373287; PHPSESSID=568be9d8e51767786dfc80915ff881a3; redux_update_check=3.6.7.13
_SERVER["HTTP_SSL"] on
_SERVER["HTTP_X_FORWARDED_FOR"] 78.108.43.18
_SERVER["HTTP_X_FORWARDED_HOST"]    mywebsite.com
_SERVER["HTTP_X_FORWARDED_SERVER"]  mywebsite.com
_SERVER["PATH"] /usr/local/bin:/usr/bin:/bin
_SERVER["SERVER_SIGNATURE"] <address>Apache Server at mywebsite.com Port 80</address>
_SERVER["SERVER_SOFTWARE"]  Apache
_SERVER["SERVER_NAME"]  mywebsite.com
_SERVER["SERVER_ADDR"]  10.0.12.2
_SERVER["SERVER_PORT"]  80
_SERVER["REMOTE_ADDR"]  77.232.66.255
_SERVER["DOCUMENT_ROOT"]    /home10a/sub002/sc11808-TCBG/www
_SERVER["SERVER_ADMIN"] [no address given]
_SERVER["SCRIPT_FILENAME"]  /home10a/sub002/sc11808-TCBG/www/info.php
_SERVER["REMOTE_PORT"]  45245
_SERVER["GATEWAY_INTERFACE"]    CGI/1.1
_SERVER["SERVER_PROTOCOL"]  HTTP/1.0
_SERVER["REQUEST_METHOD"]   GET
_SERVER["QUERY_STRING"] no value
_SERVER["REQUEST_URI"]  /info.php
_SERVER["SCRIPT_NAME"]  /info.php
_SERVER["PHP_SELF"] /info.php
_SERVER["REQUEST_TIME"] 1514373679

9
  • 1
    clear your cache and cookies and try again ... also try with another browser to see if you still get the issue Commented Dec 27, 2017 at 8:39
  • 1
    Are you using a reverse proxy like nginx, or a service like CloudFlare? Static files would work regardless because WP doesn't touch them.
    – janh
    Commented Dec 27, 2017 at 9:02
  • @TemaniAfif I have already tested in in different browsers. Also, redirect-checker.org results are not based on my browser.
    – ktsixit
    Commented Dec 27, 2017 at 10:26
  • @janh I'm not using cloudflare, as far as I know. Is there some way to find out about nginx? I don't know if my hosting company uses that. If there is nginx, then what should I do?
    – ktsixit
    Commented Dec 27, 2017 at 10:28
  • 1
    Add a simple php file executing phpinfo();, call it via https, look for the SERVER_PORT. If it's not 443, you are behind a reverse proxy. In that case, look for signs to recognize the forwarded protocol (X-Forwarded-Protocol is often used), then set $_SERVER["HTTPS"] = "on" if those conditions are met.
    – janh
    Commented Dec 27, 2017 at 10:30

2 Answers 2

0

I am replying to this question, as it hadn't been answered effectively for a long time.

As disabling plugin hasn't fixed the issue, you should take two additional steps:

Check WordPress Address(URL) and Site Address(URL)

  1. Head to Settings > General Settings.
  2. Ensure that the links entered in WordPress Address(URL) and Site Address(URL) fields are the same.

Renaming .htaccess File

  1. Go to public_html directory. Search for .htaccess file.
  2. Rename the file.
  3. Try to get access to your site. You will find that the too many redirects error is not being displayed.

You can find more information about these steps right here.

2
  • The URLs in Settings - > General are ignore when WP_HOME and WP_SITEURL are defined. Commented Feb 11, 2019 at 16:18
  • and don't forget to clear your browser cache or use "private" mode
    – ktscript
    Commented Oct 13, 2020 at 3:26
0

You can also change site address in wp_options > siteurl and home address option to new site address.

2
  • 1
    Please edit your answer, and add an explanation: why could that solve the problem?
    – fuxia
    Commented Jun 15, 2021 at 20:18
  • 1
    But OP has set WP_HOME and WP_SITEURL in wp-config, which overrides the values in the database.
    – Rup
    Commented Jun 15, 2021 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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