Redirect link

Single Hop http to https for non-www or www Domain with .htaccess

If you are behind a reverse proxy like Cloudflare or nginx this condition can help make sure the redirect is triggered RewriteCond %{HTTP:X-Forwarded-Proto} !https

Final destination: https://www.example.com

#BEGIN force https from https://guides.wp-bullet.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} ^(www\.)?hammerpedia\.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
</IfModule>
#END force https

Final destination: https://example.com

#BEGIN force https from https://guides.wp-bullet.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} ^(www\.)?hammerpedia\.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
</IfModule>
#END force https

Leave a Comment

Your email address will not be published. Required fields are marked *