Skip to content

Instantly share code, notes, and snippets.

@trey
Created September 10, 2008 04:26
Show Gist options
  • Save trey/9822 to your computer and use it in GitHub Desktop.
Save trey/9822 to your computer and use it in GitHub Desktop.
Redirecting a domain using a VirtualHost file.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^(.*)?$ http://new-example.com$1 [R=301,L]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment