I am working on a website. Previous it was running without secure http. It will affect the ranking. So I just want to know htaccess code for redirecting from http to https so that all the previous links work.
Help me.
Are you using the www. or non-www. version of the URL?
I am using www version.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.org$
RewriteRule .? http://www.domain.org%{REQUEST_URI} [R=301,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://www.domain.org%{REQUEST_URI} [R,L]
1 Like
Thanks for this code.
Is this effect the current ranking of the website?
Or any loss of the backlinks with http.
Google provides plenty of information:
From the first link:
Do I lose credit for links when I redirect to new URLs?
No, 301 or 302 redirects do not cause a loss in PageRank.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.