Http and https

When I am opening my website by searching on Google, it is opening on http instead of http. And when I am clicking on any page or category of my website, then the website is opening on the website.
Why is this happening. tell me the solution.

You need to add httpS version of your site to the Google search console

as well as 301 redirects from http to httpS (force https)

so that search bots see the redirection and know how to serve the right protocol in the SERP

apart from that, edit the canonical URL and other things in the code


You will need to add the following code in your .htaccess file inside htdocs folder. I’ve customized the code to suit your config:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

Also, you should update your GSC configuration to https://, please refer to what @oxy said:

Since you’re on WordPress, you can change the site URL from settings.


“A redirect cannot point to the same URL”
And where is canonical url.

you did not read the article, you should use .htaccess. A customized one has been provided for you above.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.