Reputation: 958
My webhost allows me to create subdomains, but not to change the root folder that those subdomains point to (which make them kind of useless for my needs). I'm wondering if it's possible to use htaccess and mod_rewrite to mimic the behaviour of a different subdomain root.
So, I would like requests to mysite.com to map to /wwwroot/mysite.com/index.html, and requests to dev.mysite.com to would map to /wwwroot/mysite.com/dev.mysite.com/index.html.
Ideally, this would be done without triggering an http redirect.
Thanks.
Upvotes: 1
Views: 1254
Reputation: 785286
You can use this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^dev\.mysite\.com$ [NC]
RewriteRule !^dev\.mysite\.com /dev.mysite.com%{REQUEST_URI} [L,NC]
Upvotes: 2