What you will learn in this article:
- How to create the .htaccess file for WordPress website;
- How to transfer your website from HTTP to https domain (with an SSL certificate).
How do you transfer your website to the secure version in the case of a WordPress website?
Note: this is a part II article regarding how you can secure your website. So make sure you already went through the part I.
Before we start the article we recommend to download those elements since we will need them later :
- Filezilla (in order to connect with your server). The link below is for mac however, you can easily for other versions by just typing “Filezilla” in the browser.
- Sublime Text (in order to rewrite the .htaccess file that we will explain later on and send the entire traffic of your website to the secure version).
1. Verify if your WebHost deal includes the SSL (Secure Socket Layer) certification. It is a standard security technology for establishing an encrypted link between the web server and a browser. In other words, that technology enables to secure the date that is displayed when a user accesses to your website. In our case since our website is hosted at OVH, the deal included the certification. However, we had to activate it. There are few documentation that explains who you can activate it in the case of OVH.
2. Access to your WordPress permalinks (dashboard > settings > permalinks) to verify if you changed the URL default format (which was the case in our example). By changing the default format, you create a file on your server that will allow you the redirect HTTP to https.
How to direct HTTP to HTTPs
3. In order to get access to your server, you can use Filezilla. Once you downloaded the program, you will be able to connect to your server with your FTP identifications (provided by the WebHost when you bought it). Your identifications are composed of host, username, password and port ;
4. When you are connected you have to click on the first file on the right and the file “www” appears:
- www(folder) > .htaccess (open it with sublime text)
- Include the redirection and register. If you refresh the browser your website should appear in the https format.
Example of The redirection:
To conclude, in order to transfer your website to a more secure version (https) you have to redirect the traffic through the .htaccess file. There is also a mean to do exactly the same by using a plugin.