0

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?

ThinkingMonkey
  • 476
  • 1
  • 9
  • 18

2 Answers2

0

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

xofer
  • 3,072
  • 12
  • 19
  • `# 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 `` & yes I have restarted httpd. – ThinkingMonkey Jan 14 '12 at 23:04
0

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

becomingwisest
  • 3,328
  • 20
  • 18
  • 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