How to force HTTPS using the .htaccess file – InMotion Hosting

To force all web traffic to use HTTPS insert the following lines of code in the .htaccess file:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Note: Be sure to replace www.example.com with your actual domain name.

Setting up Permanent 301 Redirects – WPBeginner

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ https://www.newsite.COM/$1 [R=301,L]

301 Redirects for .htaccessScott Phillips on Gist

# Redirect HTTP to HTTPS
Options +FollowSymLinks
RewriteEngine on
RedirectMatch 301 ^(.*)$ https://www.xyz.com

Redirection – MOZ

  • 301, “Moved Permanently”—recommended for SEO
  • 302, “Found” or “Moved Temporarily”
  • Meta Refresh

301 Redirects – Google Webmaster Tools – Google

301 Redirect Checkers:

Redirecting Subdirectories to the Root Directory via HTAccess – Perishable Press

  • RedirectMatch 301

The Ultimate How-To Guide on 301 Redirects – Internet Marketing Ninjas

Setting Up 301 Redirects for Dynamic URLs – seOverflow

  • This is amazingly helpful for redirecting URLs with question marks (“?”) and equal signs (“=”)
  • Example: Redirecting https://www.website.com/blog/?tag=howdy-duty to https://www.website.com

RewriteCond %{QUERY_STRING} ^tag=howdy-duty$
RewriteRule ^blog/$ https://www.website.com/tag/howdy-duty/? [R=301,L]