How to redirect all traffic to https://www
If you have an SSL certificate it’s likely your going to want to redirect all of your traffic to the certificate or https://www variation of your domain name. By forcing your website visitors to use a secure connection you encrypt the data that is being transferred from your website to your user’s browser.
If you use our CloudLinux NVMe Web Hosting you can generate a free SSL certificate from your cPanel account. Resellers Account users and their customers also have access to free SSL certificates.
Search Engines And SSLs
If search engines see your site as accessible by using http:// and https:// then this is counted as duplicate content and you could see your search engine rankings fall because of this. You can use a .htaccess file in your public_html folder to redirect all traffic to the secure version of your website. Having an SSL deployed to a website also helps with your search engine rankings.
First, if you don’t have a .htaccess file you can create one using the file manager or FTP. You can also create a WordPad document on your local computer called .htaccess and then upload it to your public_html folder. For the purpose of this guide, we’re going to redirect all traffic to https://www.
You can paste the below code into your .htaccess file and this will redirect the following protocols to https://www.domain.com
- http://domain.com
- https://domain.com
- www.domain.com
- domain.com
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
There is no need to modify the code above. The code will parse your domain name into the final action.
How was this article? Redirect Traffic https
More from Web Hosting
WordPress High Availability using MySQL Replication and HyperDB
WOKE STATEMENT: We use the terminology Master + Slave in this post. Whilst some may feel we should use …
Get The Most Out Of High Availability DNS
On the F2Hcloud network we utilize High Availability DNS. This network of DNS servers surrounds our Cloud product and provides …
Error Establishing A Database Connection – How To Fix
WordPress - Error Establishing a Database Connection You will see the Error Establishing a Database Connection message when visiting your WordPress …