daveycroqet
daveycroqet

Reputation: 2727

Redirecting New Domain Name to Server

I recently purchased a new domain name from 1and1.com and used their HTTP redirect option to point to the address of my server. Let's say, for example, the fresh domain is new.com and the established server is old.com.

I have it redirecting to old.com/new via 1and1's configuration page, which works, save for the fact that when I visit new.com, it changes the browser's URL to old.com/new. This is obviously not what I want to happen.

I've set up htaccess rules:

# BEGIN New.com
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^new.com
  RewriteRule ^(.*) http://old.com/new [P] 
</IfModule>
# END New.com

Likewise, I've done the Apache configuration of Virtual Hosts:

<VirtualHost *:80>
  ServerName www.new.com
  DocumentRoot /www/old/html/new/
</VirtualHost>

I then proceeded to flush my local DNS cache. Yet still, it persists in changing the address bar in my browser to old.com/new. What am I missing? Does it just need time to propagate or have I misconfigured / failed to properly set something up?

Upvotes: 1

Views: 250

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

You need to change the 1and1's "new.com" DNS entry to point to the same IP that "old.com" is using. While the htaccess rule (which I assume is at the new.com document root) kind of does what you want, it requires the mod_proxy be loaded, which is something I doubt 1and1 hosting allows.

What you need to do is set it up such that when you go to a site like this and do a DNS lookup for new.com, you get the same IP as when you lookup "old.com".

On old.com's server, you have the vhost setup:

<VirtualHost *:80>
  ServerName www.new.com
  DocumentRoot /www/old/html/new/
</VirtualHost>

which should be all you need to at least access the contents in /www/old/html/new/.

Upvotes: 2

Related Questions