Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How can I change my rewrite rule to keep the original subdomain url in the address bar?

Currently if I type in "" it gets redirected to ""...and I would like the address bar to stay at "".

I'm using wildcard subdomains with this rewrite rule in my httpd.conf file:

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteCond %{HTTP_HOST} !$ [NC]
   RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+) [NC]
   RewriteRule ^(.*)$ [L]

Is this even possible?

Thanks in advance.

share|improve this question

If you change the last line to proxy rather than redirect, I think that will get you the behavior you want:

RewriteRule ^(.*)$ [P,L]
share|improve this answer
+1 but note that you need mod_proxy enabled for this to work. Be extremely careful when enabling mod proxy! It's somewhat easy to create an open proxy, see the Mod_Proxy page, in particular the ProxyPass directive, for more information. – Chris S Feb 15 '11 at 20:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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