Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server running, which is a webserver as well as a DNS server. I've configured bind to accept any wildcard subdomain (* Now, I'd like for users to be able to use to view their profile page.

So far, I've succeeded to redirect to with the following lines in my Apache configuration file:

RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.mydomain\.com
RewriteRule ^(.*)$1 [R=301,QSA,L]

When I type, for example, it redirects to, which is what I want, but the URL also changes in the address bar of my browser. Is there any way to redirect to a folder, and keep in the address bar?

I can't use a separate Apache configuration file for the subdomains, as there are to many subdomains (for each user).

Thanks in advance

share|improve this question

Try removing the "R=301," from your rewrite rule. That should prevent the server from telling the browser to change the displayed domain name.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .