Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I apologize if this has been asked before, but I've looked at a number of questions here and none of them seem to answer my question.

I have a series of domains all pointing to my server. For each one I have set it's IP record and configured a VirtualHost in http.conf correctly as follows:

# example.com  
<VirtualHost *:80>  
    DocumentRoot /path/to/example
    ServerName example.com
    ServerAlias example.com
    ServerAlias www.example.com

# other.com
<VirtualHost *:80>
    DocumentRoot /path/to/other
    ServerName other.com
    ServerAlias other.com
    ServerAlias www.other.com

Now I have setup an IP on my server for test.other.com and I would like to redirect that to a completely other website: test.blogspot.com (because it moved).

I tried the following, but it redirects ALL websites to that website

# other.com
<VirtualHost *:80>
    ServerName test.other.com
    ServerAlias test.other.com
    Redirect / http://test.blogspot.com/

I think it's because of the "/"? Not really sure. I tried VirtualHost test.other.com:80 but didn't work. I tried a bunch of things and didn't work, so I really need your help.

Thanks in advance.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can do it with htaccess file, just create a couple modification are required. Make the sub domain have a proper directory:

<VirtualHost *:80>
ServerName test.other.com
ServerAlias test.other.com
DocumentRoot /path/to/directory

Then create a .htaccess file in that directory with this content

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://newdomain.com/

Same can be written inside Apache site config, i just find it more easy to manage htaccess files.

share|improve this answer
BINGO! Thanks! I added the three lines inside the VirtualHost and it worked like a charm! –  pek Jan 16 '13 at 3:37

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.