I have an Apache 2.2.15 web server with the primary site at /web/mybiz which corresponds to http://mybiz.domain.com. We now have a new subdomain http://abc.mybiz.domain.com with the homepage living at /web/mybiz/abc/index.html.

Currently, I have a simple rewrite so when people visit http://abc.mybiz.domain.com, they get redirected to http://mybiz.domain.com/abc/index.html. The includes for that homepage live in /web/mybiz/static and /web/mybiz/images.

I need to have it so that people visiting don't see the URL change in the browser, but I cannot figure out how to make it work and keep the includes all working.

  • Are you using .htaccess or adding your rewrite in apache config? Commented Jul 17, 2014 at 0:37
  • In the apache config. Commented Jul 17, 2014 at 18:17

1 Answer 1


The use of a rewrite condition along with a rule to map transparently to the subdirectory should work.

RewriteCond %{HTTP_HOST} ^abc\.mybiz\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} ^(/|.*\.html)$ [NC]
RewriteRule ^/(.*)$ /abc/$1 [L]

Now when a request for http://abc.mybiz.domain.com/ or http://abc.mybiz.domain.com/index.html is made it will be pulled from the /abc/ subdirectory. This also covers any request for an .html file. Your includes (images/css/javascript)? should be pulled in from their real locations just fine.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.