If you have experience & knowledge about how to rank your
website on Google search results, you might also be aware of the list of stuff
that can affect the ranking of a site. After the chrome 69 update, Google Chrome
started to display sites as “Not Secure” if the site doesn’t have SSL
certificates. Since then it has become essential for every website owner to
have an SSL certificate because Google algorithm does consider them while
ranking website.
If your website doesn’t have an SSL certificate, it might
experience a downfall in its ranking. To keep the safety up to the mark, you
need to have to get SSL certificates installed and redirect HTTP to HTTPS. The
process of redirection involves editing the .htaccess file. It has all the
guidelines to tell the server, how to behave in certain cases.
Out of all stated edicts in the .htaccess file, you need to focus
upon two key directives i.e Redirects and Rewriting URLs. As far as the concern
is editing the file, there are numerous ways you can adopt to do the job.
- You can edit the file on your computer and then upload it to the server using FTP.
- You can remotely access & edit the .htaccess file using the edit option within the FTP.
- You can use cPanel and edit the .htaccess file through the File Manager, which is an extensively used method.
- Below is a PHP function code another alternative method.
<
?php
functionredirectTohttps()
{
if($_SERVER[‘HTTPS’]!=”on”)
{
$redirect=
“https://”.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’];
header(“Location:$redirect”);
} }
?>
While editing the .htaccess file you need to add the forth code.
RewriteEngine
On
RewriteCond
%{HTTPS} off
RewriteRule
(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
And after uploading the .htaccess file it is important to ensure
that the permissions are set properly. This code intentionally asks the server
to use mod_rewite for searching if HTTPS is active or not, and if not then
apply it accordingly.
No comments:
Post a Comment