Server Fault is a question and answer site for system and network administrators. 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

This is my apache configuration (most interesting part of it):

<VirtualHost *:80>

Works fine and my server properly responds to HTTP requests. Now I'm going to add an alias to this domain. I want all requests to produce the same responses as to, for example: ->

What is important, I don't want to see HTTP redirections (301 code). I want to hide URL from a user. All that he has to see is URL.

share|improve this question
up vote 3 down vote accepted



inside the VirtualHost section

for the rewrite

RewriteCond %{HTTP_HOST}   ^my-new-domain\.com
RewriteRule /test/(.*)     /$1                   [QSA,L,P]
share|improve this answer
No, that doesn't deal with the /test part. – nickgrim Mar 10 '11 at 8:39
Exactly, this is just the first part of the solution. Then I need to use RewriteRules, but can't understand how to specify them properly.. @jamespo can you help? – yegor256 Mar 10 '11 at 8:59
many thanks! Btw, do you know how to specify rules when I need to extend URL paths: -> – yegor256 Mar 10 '11 at 21:07

Use mod_rewrite with mod_proxy ( Otherwise, if domains differ, mod_rewrite performs an external rewrite even if both are served from the same host.

Something like

RewriteRule ^ [QSA,P]

Another solution would be to create a symlink test in’s root dir to the root dir of

share|improve this answer
RewriteRules don't match on the full URL I don't think? – jamespo Mar 10 '11 at 11:14

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.