I have site hosted at a domain www.x.com. I have a newer version of the same site hosted at www.y.com. I would like to retire x.com, but for reasons of familiarity and pagerank, I need to keep the x.com domain for a while.

What are my options in regards to forwarding or redirecting users that arrive at x.com to y.com?

Ideally, I don't want to pay the hosting fees at x.com any longer, but I will if needed.


Whatever you choose, you'll need to keep domain x.com registered.

Having done that you can setup an extra vhost on the server that handles y.com. You then change the A records for x.com to point to the same IP that y.com has (or use a CNAME if you prefer).

That vhost definition for x.com will redirect any traffic landing on x.com to y.com. If you use apache it would probably look something like this (where aaa.bbb.ccc.ddd is the IP address of the y.com server)

<VirtualHost aaa.bbb.ccc.ddd:80>
    ServerName x.com
    ServerAlias www.x.com

    RedirectMatch permanent ^/$ http://y.com$1

The important part of that stanza above is the use of the 301, permanent, direct code, which is recommended by SEO experts to "transfer" the pagerank of one domain to another. I have heard this process can take some (read 6 or more) months to take effect

  • 2
    +1 for point out that you should use the 301 redirect code as part of the redirect. This is a perm change, indicate so. Don't take the easy way out of CNAME it will cause more trouble than it's worth with search engines, and your users won't see the change. There are also services out there that "host" the redirect for you if you don't/can't do it yourself.
    – WaldenL
    May 5 '09 at 13:34
  • Just to clarify - I will keep the x.com domain registered. I just want to dump the hosting cost.
    – Jeff
    May 13 '09 at 14:28

Do not use the CNAME if you're planing to retire x.com. Use 301 permanent redirect instead.

If you'd use CNAME, Google (and other search engines) will keep sending users to x.com, while with 301, they'll send them directly to y.com.


The easiest option is to create a CNAME in DNS for www.x.com and point it at www.y.com and configure the web server to listen to both domain names.

A nicer alternative is to return a 301 (permanent redirect). Most browsers will automatically update bookmarks/favorites.


You have several options:


Set up an CNAME record in your zone file:

foo.example.com.        CNAME  bar.example.com.

Using your domains:

www.x.com.        CNAME  www.y.com.

This is your best option as it means you don't need to have a physical server.

Apache/IIS Redirect

Use your web serving software to redirect users, this is more flexible but requires you keep a sever up and running.

HTTP Meta Refresh

The simplest option a simple meta refresh tag:

<META http-equiv="refresh" content="0;URL=http://www.y.com">

Again you'll need a server,

  • The META refresh tag is far from standard and does not work with most robots.
    – bortzmeyer
    May 8 '09 at 11:53
  • meta is simply ugly
    – Pacerier
    Jul 25 '11 at 10:03

Assuming you are running DNS, and Apache, on Linux and that the files for both, x and y.com domains reside on the same machine:

  • Add the y.com entry to your DNS, so it can be resolved
  • Add y.com as a virtual domain on your Apache, and point it to the same physical location where x.com is.
  • As Richard stated, set a 301 (permanent redirect) on x.com to y.com.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.