Skip to content

Instantly share code, notes, and snippets.

@BananaAcid
Created January 8, 2017 14:25
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 BananaAcid/2f44ae49cd50d2a9383e8e8b899cf3fe to your computer and use it in GitHub Desktop.
Save BananaAcid/2f44ae49cd50d2a9383e8e8b899cf3fe to your computer and use it in GitHub Desktop.
Subdomain mapping within htaccess
# Nabil Redmann 2017
#
# assumed: this htaccess is within htdocs/
#
# dev.* mapping to ./dev/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?dev.domain.tld [NC]
RewriteCond %{REQUEST_URI} !^/dev(/.*)?$
RewriteRule ^(.*)$ dev/$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?dev.domain.tld [NC]
RewriteCond %{REQUEST_URI} ^/dev(/)?$
RewriteRule ^(.*)$ dev/index.php?$1 [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment