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

I'm fighting a losing battle over here. I've got an easily misspelled domain name. So I purchased the misspelling. Now, I need to setup the misspelled domain name to redirect everything to the properly spelled domain name, but I need to keep the subdomains.

Example: should redirect to should redirect to

I already have a dozen or so subdomains setup for my domain, and I foresee many additional ones in the future. I would really rather not have to input them multiple times across multiple domains.

And I'd really like to have a landing page with a link, just in case the redirect doesn't work. Like an "Update your bookmarks!!1!" page. So, if a solution involves php or javascript, I'm all over that as well.

Any advice would be greatly appreciated.

Thanks in advance,


tl;dr I need to redirect domains but keep subdomains intact. -> where sub is a variable and needs to be the same on both URLs.

share|improve this question

This might help:

What you want is a wildcard DNS A record entry for:


pointing to your webserver.

On the webserver, you want a rewriting engine correcting the misspelling and serving up a 301 redirect to How depends on what you're running on the server side, but Apache Rewrite rules are common.

I don't know of a way you can also serve up a link - what kind of browser doesn't support redirects? Perhaps if you do it in PHP or similar you can send a redirect response header and a page with a link? Not sure if that can work. - examples:

share|improve this answer
TessellatingHeckler, that's on the right track. However, since I am using GoDaddy for hosting, and the make me do everything through their web gui, any ideas how to do what you're talking about? I tried adding an asterisks in an A Name entry, but it wanted an ip address instead of a URL. And since I'm using the same ip address for both domains, it wasn't going to work. Any suggestions? Thanks in advance. – Critologist Oct 24 '10 at 16:33
A DNS entry to a hostname needs to be a CNAME instead of an A record, but you should be able to do it with an ip address - both on the same webserver won't make any meaningful difference. – TessellatingHeckler Oct 25 '10 at 0:22

(Assuming apache is the web server.)

Create a default VHOST with

RewriteRule ^/(.*)$ /foo.php [L]

In foo.php do something like (I don't know php so there is psuedocode):

$server_name = $_SERVER["SERVER_NAME"];

if ($server_name does-not-match "*") {
  header("HTTP/1.0 404 Not Found");

$server_name = replace('', '');

header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $server_name . $_SERVER["REQUEST_URI"]);


just in case the redirect doesn't work

301/302 redirects work and have worked for a long time.

If you insist though you could return a page that has a link to the non-typo domain and use a meta http-equiv="refresh" or a javascript reload but that is so 1996.

share|improve this answer

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.