Skip to main content

Redirect HTTP to HTTPS on Wordpress over Cloudflare

Found a pretty simple and to the point tutorial explaining how to redirect all HTTP requests to HTTPS on Wordpress -> https://wp-mix.com/htaccess-redirect-http-to-https/. Only these won't work if you're using Cloudflare as your server.
If you add rules to your htaccess file to set up the redirect, you will see that the browser says "the website redirected too many times" or something like that.

hmmm.........

Few simple steps to add the redirect: (you don't need the htaccess):

  • Head to Cloudflare Dashboard.
  • Click on the website that needs the redirect.
  • Go to SSL/TSL tab.

  • Find the setting called "Automatic HTTPS Rewrites". If it is off and grey. Turn it on and it should turn [green].


Ok.
Now we create a post. Can't. Because Wordpress fails to save any changes made in the editor.

Wordpress says "updating failed you are probably offline". Why?

In the General Settings of your Wordpress, the site url is still http://yourwebsite.com and not https://yourwebsite.com
As per Wordpress documentation, the website url in General Settings matter a lot:
These settings control the display of the URL in the admin section of your page, as well as the front end, and are used throughout the WordPress code.
It should be https://yourwebsite.com . It can't be changed from the Wordpress CMS. You'll have to head to the backend files.


In the tutorial, there are many different ways to change the address of where your website is served from. Why? Which one is the best? Does it depend on the server?

Didn't work, probably because of some reason related to the server being on Cloudflare. 

I didn't try all the methods given in the tutorial above. You go ahead, try them all. Did you make it work? *gentle pats on your back*

If it doesn't work - Anywho...somehow..for whatever precise reason, you can't add a new post now.

Install a plugin called - reallysimpleSSL. It will make sure that all content on your website including JS, CSS, yada yada, is served through HTTPS. Problem solved. 

There definitely must be a way to do it by modifying one of the Wordpress files. I'll find it if I remember I want to find it and post here.

Comments

Popular posts from this blog

Installing Pyenv with ZSH

  This post is written assuming you are using OhMyZsh. Install Pyenv as per this:  https://realpython.com/intro-to-pyenv When I followed the instructions as they were in the guide above, I got the error: "command not found: pyenv". Zsh is not able to find pyenv even though it has been correctly installed. So we can tweak the steps a bit to adjust them to our Zsh shell. While installing, instead of the command   curl https://pyenv.run | bash , use the command   curl https://pyenv.run | zsh . This will install Pyenv. The guide asks you to add some lines of code in bashrc. We'll modify those lines and add them into our zshrc. Enter this command in terminal to be edit the zshrc:   sudo nano ~/.zshrc . Nano is a text editor in terminal that allows you to read and edit text files within the terminal. The command  sudo nano  will open the contents of zshrc inside the terminal just as any other text editor with GUI would. You can edit it the fil...

Ways to Search From Any Damn Location

 VPNs suck. Right now we only want to make the website we are visiting "feel" that we are not where we are but where we tell it where we are. To lie to your ISP, you'd still need a VPN, a paid one. There's one alternative to that too, but we'll talk of it later. Several ways: 1. UULE Parameter UULE is a handy search parameter made by Google Ads to help themselves easily see how their search results vary from location to location. It's pretty useful to us. It looks like this: &uule=w+CAIQICIdTG9uZG9uLEVuZ2xhbmQsVW5pdGVkIEtpbmdkb When you append this to a search URL like this https://www.google.com/search?q=[search-term]&oq=[search-term], you'll get search results for London, UK. Try this:  https://www.google.com/search?q=aaa&oq=aaa&uule=w+CAIQICIdTG9uZG9uLEVuZ2xhbmQsVW5pdGVkIEtpbmdkb20&hl=en&gl=uk The UULE parameter consists of w+CAIQICI + [string length] + [base-64 encoded location] I've made bookmarklets for common search locat...

Installing Scrapy With Pyenv (Linux)

If you don't already know what Scrapy is, this post won't tell you. This post will tell you how to install Scrapy. Here's what this post contains: 1. Installing and working on Python's latest version on Linux 2. Installing Pyenv 3. Installing Scrapy Installing and working on Python's latest version on Linux Scrapy would require Python 3.6+. Default Python version on a linux distro is most likely Python 2.7. To work with Scrapy, you'd need to install a compatible version.  You can easily install python using the standard sudo apt install and commands of the likes, or you can download and build it, but it's not that simple: Running projects on a latest Python version on Linux is tough. Why? Because: 1. System-wide Python 2.7 The system-wide Python 2.7 is used by several of system's applications/programs. To keep them working as they do, the system Python needs to continue being the same, forever. So, you cannot replace it with any of the latest Python 3 ve...