.htaccess rewrite subdomain to directory
Try putting this in your .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^sub.domain.com RewriteRule ^(.*)$ /subdomains/sub/$1 [L,NC,QSA] For a more general rule (that works with any subdomain, not just sub) replace the last two lines with this: RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com RewriteRule ^(.*)$ subdomains/%1/$1 [L,NC,QSA]