How to make one hop HTTP to HTTPS 301 redirect on CentOS Web Panel (CWP) Environment?
Author: Dimitar Radev | Posted on: September 15, 2020 |

Redirecting WWW and non-WWW HTTP URLs to the final HTTPS location with one hop (also called site-wide redirect chains) is important for Search Engine Optimization for a few reasons:
- Link authority is lost – Every redirect reduces the Link authority. It’s just a bit according to Search Engine Land but we are trying to get every bit of optimization possible to be ahead of the competition.
- Google Bot will most likely stop following redirects after the 4th or 5th hop.
- Crawl budget is lost – Every redirect reduces the crawl budget.
From the user standpoint, the site will also appear to load faster if you clean up the hops on redirects coming from the non-canonical versions of your domain.
The two snippets below are used on CentOS Web Panel (CWP) Environment. Make sure to place them on top of your main .htaccess file.
HTTP to HTTPS 301 redirect to WWW
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.wp-snipp.ninja/$1 [R=301,L]
HTTP to HTTPS 301 redirect to non-WWW
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://wp-snipp.ninja/$1 [R=301,L]
If you want to recieve the latest WordPress snippets, tutorials, tricks and useful information about web development, seo, social media marketing, google you can Subscribe to our newsletter. All you need to do is to fill the Subscribe form below, verify your Free Subscription in your email and start read our daily useful tips and tricks straight in your mailbox.
Note* we hate spam and our newsletter is powered by Google Feedburner and you will not get spam messages in your mailbox.
So this will solve redirect hops correct ?
Yes but be careful as a redirect from another place like the hosting panel may need to be additionally disabled for this to properly work. If no errors when the code is added I check for the hops here https://varvy.com/tools/redirects/