Start Chatting Already [No Registration Required]
This will take you to the chat room you are looking for
Hello everyone, I would not like to do any formalities in this post because this website is not a tutorial hub. Its a chat website. We wanted to setup a blog for our website and so we chose WordPress however, we started facing a lot of issues such as Admin Login was failing and we were getting too many redirects error from the browser side and admin panel login form refreshed on submit. All of this was happening because WordPress was unable to cope with Https. If your WordPress Configuration doesn’t have this setting $_SERVER[‘HTTPS’] = ‘on’; then you will face the above and many more problems.
If you search about WordPress too many redirects error or How to make wordpress work with cloudflare ssl, you will end up getting low quality and unhelpful articles which will make you install plugins and stuff. So here’s the simple way.
This article contains three step by step guides:
- I show you how to migrate wordpress to https with 1 line of code
- How to fix broken images after https migration with 1 line of code
- If you have been locked out of your admin panel while trying to migrate to https, I will show you how to fix this with 2 lines of code.
How do I migrate wordpress from Http to Https
Note: I assume that you have already configured ssl on your domain. If not the fast, easy and free way to get SSL is [Add your website to CloudFlare.com], [Goto Crypto>Enable SSL]
Open WordPress admin panel and goto Settings>General and update WordPress Address (URL) and Site Address (URL) to https://example.com. Yes, update both the urls. If someone says to update only one of them, they are stupid.
You will be locked out of your admin panel after this step. Next step will fix this.
Open wp-config.php and add this line just below <?php
$_SERVER[‘HTTPS’] = ‘on’;
Done! No need to install any plugin.
My blog’s images are appearing broken
If your images are broken. Do the following:
- Open PhpMyAdmin
- Click on wordpress>wp_posts [Database and table name could be different for you]
- Goto SQL tab
- Type the query below and hit Go.
Update wp_posts set post_content = REPLACE(post_content, ‘http://yourwebsite.com’, ‘https://yourwebsite.com’);
It’s as easy as that!
I have been locked out of admin panel
If you have been locked out of admin panel while changing WordPress Address (URL) to Https, do the following:
Method 1:
Add the following code to your wp-config.php file right below <?php
define('WP_HOME','https://example.com'); define('WP_SITEURL','https://example.com');
Method 2:
Login to PhpMyAdmin and update the urls in settings table of wordpress database. Do as shown in the image below.
thanks for this article