Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I auto forward/turn/convert (whatever the correct term is) URLs entered as,, OR to or I basically want to push anything coming in with the www subdomain and that top level domain to forward to the new domain but include the paths (if any).

I'm using an shared web host provider running Apache web server.

Thanks in advance

share|improve this question
up vote 1 down vote accepted

Put a .htaccess file in the root of the old domain once you have moved.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*) [NC]
RewriteRule ^(.*)$$1 [R=301,L]

The 301 will tell Google (and other bots) you have permanently moved. Some more info on the Rewrite can be found here: mod_rewrite cheat sheet

share|improve this answer
Thanks for your reply. Will this catch both AND Also, I need outside sources (like search engines and bots) to NOT see this as a permanent change/move. The .CO domain is actually part of a marketing & advertising campaign and need everyone seeing/thinking this is as a real domain and keeping all spellings of it as *.CO. Only when the user gets to the site does the *.COM matter (its fine that users see the change from .co to .com when visiting). Is it possible to still forward and not have it known to the world as a forward? – crashintoty Feb 25 '11 at 9:15
If the redirect is temporary, you should change the 301 (end of 4th line) to 302. Google will discard the changes then. If and serve up the same pages now, you'll be fine with this code. If is different from (seems highly unlikely to me) just put this in the 2 different roots. – Bart De Vos Feb 25 '11 at 9:19
Thanks again TiZon. I hate to be a pain but I looked up 301 vs. 302 and you were absolutely right, but I discovered MSN/Bing and Yahoo will handle 302 like 301 unfortunately. Now I'm worried my campaign won't look as good. Here's a more specific example of what I'm trying to achieve:,, (and www subdomain, if entered) and paths (if any) redirect to As you can probably figured out the *.it, *.me, *.us is part of the coolness of the web app/site and essential aesthetically. Everyone must see and use them. Is redirects still what I need? – crashintoty Feb 25 '11 at 18:08
I see. I think you would want one server and then a number of vhosts. This way, it's possible to use multiple domains that serve up the same content. More info to be found here: Happy to help ;-) – Bart De Vos Feb 25 '11 at 19:07
I was worried that may be the case. Unfortunately I'm on a shared web host provider, I highly doubt I have access to stuff like that. I'll make do with your mod_rewrite solution for now. Thanks so very much TiZon! – crashintoty Feb 25 '11 at 19:44

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.