httpd redirect code example
Example 1: how to redirect http to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Example 2: 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]