If your site has an SSL certificate, it isn’t automatically secure for visitors. As long as the HTTP version of your website remains accessible, people and search engines can still enter through the unsecured variant. The solution is a 301 redirect that automatically forwards every request on HTTP to HTTPS. This article shows you how to set this up correctly, via .htaccess or in Plesk, and which pitfalls to avoid so you don’t lose rankings.
Why an HTTP to HTTPS redirect is important
Without a proper redirect, your website can be accessible at two addresses at once: the HTTP and the HTTPS version. This results in duplicate content, confuses visitors (no lock icon in the address bar), and causes link value to be spread across two variants of the same page. A 301 redirect (permanently moved) solves this in one go: every visit to the HTTP version is immediately forwarded to HTTPS, and search engines understand that the HTTPS version is the only correct one.
Setting up a redirect via .htaccess
If your website runs on Apache or LiteSpeed, you usually arrange the redirect via the .htaccess file in the root directory of your website. Add the lines below at the top of the file:
Open the .htaccess file
Go to your hosting environment’s file manager and open the .htaccess file in the root directory of your website. Can’t see the file? You may need to enable the display of hidden files first.
Add the redirect rule
Add at the top: RewriteEngine On, followed by RewriteCond %{HTTPS} off and RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]. Note the R=301, which ensures a permanent redirect instead of a temporary one.
Save and test
Save the file and visit your site via the http address in an incognito window. You should automatically end up on the https version, with a lock icon in the address bar.
Check the status code
Use an online redirect checker to check whether the page really returns a 301 and not accidentally a 302. A 302 (temporary) is assessed differently by Google and can delay the transfer of rankings.
Setting up a redirect in Plesk
If you use Plesk as a control panel, you don’t need to write any code yourself. Go to your domain, open the Hosting & DNS tab, and look for the option for SSL/TLS support. There you’ll find a checkbox like “Redirect from HTTP to HTTPS” or a similar setting. Enable it and Plesk will arrange the redirect automatically at the server level, without you having to modify the .htaccess file. This is the most reliable method, because the rule won’t disappear when your website or theme is updated.
If you’re working with WordPress, also pay attention to the domain address set under Settings β General. If it still says http instead of https there, this can still cause unexpected loops or mixed content, even if the server redirect is set up correctly.
Common mistakes and how to prevent them
A few pitfalls cause a redirect not to work as intended:
- Redirect loops: often occur when both your CMS and your server try to redirect, working against each other. Check that the redirect is only set up in one place.
- 302 instead of 301: a temporary redirect does forward visitors, but signals to search engines that the old URL is still important. Always use 301 for a permanent change.
- Internal links not updated: if your website itself still points to http links, this causes extra redirects and a slower loading time. Update internal links to https wherever possible.
- Sitemap and canonical not updated: make sure your sitemap.xml and canonical tags also point to the https version, otherwise confusion about which version is correct will remain.
Want to make sure your hosting environment is ready for a proper SSL setup? Check out the options for webhosting with free SSL. If you’re unsure about your current configuration after a migration, it helps to go over the steps for switching to another host again, so that redirects are correctly taken into account.
Frequently asked questions
Should I also redirect www to non-www (or vice versa)?
Yes, it’s wise to choose one fixed spelling for www or non-www in addition to redirecting http to https. Combine both redirects so that only one unique URL version remains in the end.
Will I lose rankings due to a redirect?
With a properly set up 301 redirect, the majority of the ranking value is transferred to the new URL. Temporary fluctuations are normal, but in the long run HTTPS actually benefits your discoverability.
Does the redirect also work for images and API calls?
A server-wide redirect essentially catches all requests, including images and scripts. Still, it’s better to have internal references point directly to https, which saves extra redirects and loading time.
Conclusion
A properly configured HTTP to HTTPS redirect ensures that visitors and search engines always end up on the secured version of your website. Use a 301 redirect via .htaccess or, even easier, via the SSL settings in Plesk. Then check that internal links, sitemap, and canonical tags also point to https, so no confusion or ranking loss occurs.