Skip to content

Instantly share code, notes, and snippets.

@edheltzel
Last active May 25, 2016 11:41
Show Gist options
  • Save edheltzel/2e5ee6a0c28d166927a02502d97b5c20 to your computer and use it in GitHub Desktop.
Save edheltzel/2e5ee6a0c28d166927a02502d97b5c20 to your computer and use it in GitHub Desktop.
route subdomain requests to directory
ErrorDocument 404 /
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.domain\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule (.*) http://domain.com/%1 [R=301,L,NC]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment