Skip to content

Instantly share code, notes, and snippets.

View michael-sumner's full-sized avatar
:electron:
Making the world better with incredible digital experiences

Michael Sumner michael-sumner

:electron:
Making the world better with incredible digital experiences
View GitHub Profile
@michael-sumner
michael-sumner / .htaccess
Created February 5, 2022 19:07
Redirect old domain to new domain and all pages within it, using htaccess file.
# BEGIN DOMAIN REDIRECT 301 TOWARDS newdomain.com
# ADD THE CODE WITHIN YOUR OLDDOMAIN.COM
# MODIFY THE www TO YOUR SPECIFIED SUBDOMAIN
# IF YOU ARE USING A NAKED DOMAIN, THEN REMOVE !^www\.
# IF YOUR NEWDOMAIN RESOLVES TO ANOTHER SUBDOMAIN
# THEN USE THAT NEW SUBDOMAIN INSTEAD OF www.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.newdomain\.com
RewriteRule (.*) https://www.newdomain\.com/$1 [R=301,L]
# USEFUL FOR: