When activating Cloudflare SSL on the new WordPress installation on the new domain, it’s quite common that website stuck on redirect loop. That’s annoying, but easy to fix by adding just one line of code on WP configuration file.
Open the wp-config.php file located at the public root using your favorite FTP-client or control panel file editor and find the following line:
/*That’s all, stop editing! Happy blogging. */
Insert the following code just before the above line and save.
$_SERVER['HTTPS'] = 'on';
You can also add the following lines to make sure WP uses only SSL
define('FORCE_SSL_ADMIN', true); define( 'WP_HOME', 'https://example.com' ); define( 'WP_SITEURL', 'https://example.com' );
Reload the URL and now WP redirect loop should be fixed!