Skip to content

Instantly share code, notes, and snippets.

@4lun
Created October 16, 2013 10:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save 4lun/7005872 to your computer and use it in GitHub Desktop.
Mod rewrite to redirect entire domain (including subdomains) to new domain while preserving the request URI
<IfModule mod_rewrite.c>
# Enable Rewrite Engine
RewriteEngine On
RewriteBase /
# Redirect *.domain.co.uk* to *.domain.io*
RewriteCond %{HTTP_HOST} ^(.*)domain\.co\.uk$ [NC]
RewriteRule ^(.*)$ http\://%1domain\.io/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment