How to redirect subdomain to folder using .htaccess
NodeHost handles subdomains and domains on the same site as the same. However you still might need to handle subdomains as subdirectories of your main domain. Luckily, this can be easily done with some .htaccess. Add subdomain.domain.com as alias to domain.com. Create following .htaccess file in the domain.com/public_html/ directory `` RewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain\\.domain\\.com$ RewriteCond %{REQUEST_URI} !^/subdomain/ RewriteRule (.*) /subdomain/$1 `` Create subdomain directory web/domain.com/public_html/subdomain, this is where the files will be for the sub domain. This is a redirect not a virtual redirect. You can handle wildcard subdomains too. Here is .htaccess for that. `` RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(?!www\\.)([^.]+)\\.domain\\.com$ [NC] RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*?::\\1 RewriteRule ^(.*)$ /%1/$1 [L] `` Just place your .htaccess in your main /public_html folder.