Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Just a quick beginner's question here. I have a webapp located at, and it generates short URLs for long posts automatically - so rather than visit I can just type and be taken there automatically.

However, I've bought a shorter domain name - - and I want to be able to visit and be redirected (or forwarded) to Or --> This way, although it seems a tad illogical it saves me setting up another hosting account on to deal with the URL shortening.

Is this possible? I realise you can forward domains, but, can you forward domains AND forward the URL segments?



share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can set up an A record for to point the same address as is given in the A record for so your users trying to visit will actually send their requests to the same server as though it will appear as in their address bar and the HTTP server at domainxyz.dom will see in the requests a host header containing the original URI with in it.

Another way to solve your problem is to set up an HTTP rewrite service on the server at that will rewrite URLs to have the hostname In nginx it will be something like:

server {

  location / {
    rewrite (.*)$1 permanent;

I do not know anything about configuring this with apache's mod_rewrite or lighttpd but I believe this is also possible with them.

share|improve this answer
I just came across this question today and I see this answer also makes a misleading suggestion which is actually incorrect, and as the accepted answer that may mislead other readers somewhat. – Greg A. Woods Sep 1 at 18:25
Thanks for updating! CNAMEs can only be used for 3rd level domains and longer ones. – timurb Sep 3 at 5:17
The level is irrelevant -- CNAMES can only be used for domains where absolutely no other resource records are used. – Greg A. Woods Sep 3 at 19:05
You can either use A or CNAME -- I think this was in my initial posting. What I was missing is you can't use CNAMEs for 2nd level domains.Thank you for correcting me in this! – timurb Sep 4 at 20:41
The level is irrelevant -- anywhere any other records are required, such as where an SOA and NS records are required, there cannot be a CNAME. An SOA and NS records are not always at the second level -- take for example where the SOA would be at the third level. – Greg A. Woods Sep 4 at 20:45

In addition to what Erthad has said, you can also accomplish this using pound - a reverse proxy and load-balancer - using the "Redirect" configuration.

share|improve this answer
Pound looks pretty intense. Just a shame I can't use it on MediaTemple ;) but thank you for your suggestion! – Jack Jun 16 '10 at 9:09
You are welcome! – sybreon Jun 18 '10 at 17:19

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.