Skip to content

Instantly share code, notes, and snippets.

@joduplessis
Created July 30, 2019 07:49
Show Gist options
  • Save joduplessis/e20c5a2e2f97e8afe0a495bad8cd332e to your computer and use it in GitHub Desktop.
Save joduplessis/e20c5a2e2f97e8afe0a495bad8cd332e to your computer and use it in GitHub Desktop.
Rules for directing all subdomains to a folder (wildcard subdomains) - and exclude a specific subdomain, like dev.
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# Dev app sub domain masking
RewriteCond %{HTTP_HOST} ^dev\.yourdomain\.com$ [NC]
RewriteRule ^((?!dev/).*)$ /dev/$1 [L,NC]
# All sub domain masking
RewriteCond %{HTTP_HOST} ^([\w-]+)\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ /app/$1 [L,NC]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment