Skip to content

Instantly share code, notes, and snippets.

@cameronjonesweb
Last active May 30, 2017 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronjonesweb/f64d344c67e717d9197d3ad2d7de9ba8 to your computer and use it in GitHub Desktop.
Save cameronjonesweb/f64d344c67e717d9197d3ad2d7de9ba8 to your computer and use it in GitHub Desktop.
Redirect all from domain
RewriteEngine On
# Replace example.com with the target domain
RewriteCond %{HTTP_HOST} !example.com$ [NC]
# Any paths you wish to exclude for some reason
RewriteCond %{REQUEST_URI} !^/training
# Preserve the path
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# All to the root
RewriteRule ^(.*)$ http://example.com/ [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment