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

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

I want to redirect any requests to thinkingmonkey.com to thinkingmonkey.me.

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /mysite
    ServerName thinkingmonkey.me
    ServerAlias www.thinkingmonkey.me
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
    Options -Indexes +FollowSymLinks
    RewriteEngine On
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    ServerName thinkingmonkey.com
    DocumentRoot /mysite/happ

    Redirect thinkingmonkey.com  http://thinkingmonkey.me/

  #  Redirect / http://thinkingmonkey.me/ #have even tried this

    ServerAlias www.thinkingmonkey.com
    RewriteEngine on
</VirtualHost>

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

What am I doing wrong?

share|improve this question
add comment

2 Answers 2

Try

Redirect /  http://thinkingmonkey.me/

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

RedirectMatch /(.*) http://thinkingmonkey.me/$1

http://httpd.apache.org/docs/2.2/mod/mod_alias.html

share|improve this answer
    
# Redirect / http://thinkingmonkey.me/ #have even tried this Its there in the question. –  ThinkingMonkey Jan 14 '12 at 22:56
1  
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
add comment

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

share|improve this answer
    
yes it is.. The virtualhosts are working fine. only theredirect is not. –  ThinkingMonkey Jan 14 '12 at 23:01
2  
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
add comment

Your Answer

 
discard

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.