Skip to content

Instantly share code, notes, and snippets.

@getdave
Created November 5, 2018 16:22
Show Gist options
  • Save getdave/d7a0c96aeafcf238869bf8cc500119ca to your computer and use it in GitHub Desktop.
Save getdave/d7a0c96aeafcf238869bf8cc500119ca to your computer and use it in GitHub Desktop.
Redirect website including all sub dirs to equivalent on new domain with query string identifier
RewriteEngine on
RewriteCond %{HTTP_HOST} ^source-domain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.source-domain.com [NC]
RewriteRule ^(.*)$ https://target-domain.com/$1?source=sourcedomain [L,R=302,NC]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment