Apache: Redirect blog.foobar.com to www.foobar.com

Posted by Steve Griff on Stack Overflow See other posts from Stack Overflow or by Steve Griff
Published on 2010-04-04T17:30:37Z Indexed on 2010/04/04 17:33 UTC
Read the original article Hit count: 530

Filed under:
|

Hello,

I have a site at blog.foobar.com that I have closed down, and I want any page requested there to be forwarded to www.foobar.com

I want my VirtualHost config to do this for me. I currently have the following lines that does nearly what I want but not exactly:

redirect permanent / http://www.foobar.com

Unfortunately what happens is that if I ask for blog.foobar.com instead of forwarding to www.foobar.com it serves the pages on blog.foobar.com instead.

Is there a way doing this in the VirtualHost config or should I use a .htaccess file instead?

Regards

Steve

© Stack Overflow or respective owner

Related posts about apache

Related posts about apache2