htaccess redirect to page code example

Example 1: 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 2: htaccess redirect to html page

RedirectMatch 301 ^/blog/about /blog/about.html

Example 3: 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]

Tags:

Misc Example