Redirect htaccess file
.htaccess
## Non to WWW
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
## www to Non www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]
## Redirect certain extension
RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule ^(.*).php$ /$1.htm [R=301,L]
## Redirect old domain to a new domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^davidcohenphd.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.davidcohenphd.com [NC]
RewriteRule ^(.*)$ https://www.skyhub.ca/$1 [L,R=301,NC]
## Redirects example.com/cool-page.html to example.com/cool-page
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteCond %{REQUEST_URI} ^(.+)\.html$
RewriteRule (.*)\.html$ /$1 [R=301,L]
## Redirects the index.php file to the root domain
RewriteRule ^index.php$ https://www.example.com/ [R=301,L]
## Redirects the index.php file to the root domain
RewriteCond %{THE_REQUEST} ^[A-Z][3,9]\/([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index.php$ https://www.example.com/$1 [R=301,L]
## Redirect 404 Errors same domain
Redirect 301 /news/uploads/2/3/7/5/23754531/marital_stability.pdf https://www.skyhub.ca/news/