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

I have 2 urls say and both have ip-address (A.K.A localhost).

I want to redirect any requests to to

<VirtualHost *:80>
    DocumentRoot /mysite
    ErrorLog logs/
    CustomLog logs/ common
    Options -Indexes +FollowSymLinks
    RewriteEngine On

<VirtualHost *:80>
    DocumentRoot /mysite/happ


  #  Redirect / #have even tried this

    RewriteEngine on

When I try to access the url does not get redirected to The url in the brower's address bar remains

What am I doing wrong?

share|improve this question

2 Answers 2


Redirect /

Note that this will only redirect the home page. To redirect all pages:

RedirectMatch /(.*)$1

share|improve this answer
# Redirect / #have even tried this Its there in the question. – ThinkingMonkey Jan 14 '12 at 22:56
Ah so it is. Are you sure you have mod_alias installed (it's usually installed by default) and have you restarted Apache? Also, do you have a NameVirtualHost line somewhere before these vhost blocks? – xofer Jan 14 '12 at 23:00
ya, mod_alias is installed, NameVirtualHost *:80 is present before <VirtualHost> & yes I have restarted httpd. – ThinkingMonkey Jan 14 '12 at 23:04

Be sure that you also have NameVirtualHost *:80 specified before your virtual host directives, then try the Redirect / again.

share|improve this answer
yes it is.. The virtualhosts are working fine. only theredirect is not. – ThinkingMonkey Jan 14 '12 at 23:01
How do you mean the vhosts are working fine? There's no DocumentRoot directive in the .com vhost block; if it's displaying the content in /mysite, then chances are the vhosts are not working. – xofer Jan 14 '12 at 23:04

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.