how to redirect using htaccess code example
Example 1: htaccess redirect to https
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^yourdomain\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com
RewriteRule .* https://yourdomain.com%{REQUEST_URI} [R=301,L]
Example 2: https redirect htaccess
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Example 3: htaccess redirect to html page
RedirectMatch 301 ^/blog/about /blog/about.html
Example 4: htacces redirect
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.vecchiodominio\.com$
RewriteRule (.*) http://www.nuovodominio.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^vecchiodominio\.com$
RewriteRule (.*) http://www.nuovodominio.com/$1 [R=301,L]