Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

However, I've bought a shorter domain name - short.com - and I want to be able to visit short.com/a5c and be redirected (or forwarded) to domainxyz.com/a5c. Or short.com/7f0 --> domainxyz.com/7f0. This way, although it seems a tad illogical it saves me setting up another hosting account on short.com 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?

Thanks!

Jack

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You can set up either an A or CNAME record for short.com to point the same domain as domainxyz.com so your users trying to open short.com/a5c will actualy send the requests to the same server as domainxyz.com though it will appear as short.com in their address bar.

Another way to solve your problem is to set the HTTP rewrite service on short.com that will rewrite urls to domainxyz.com. In nginx it will be something like:

server {
  server_name short.com www.short.com;

  location / {
    rewrite (.*) http://www.domainxyz.com$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

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 W Jun 16 '10 at 9:09
    
You are welcome! –  sybreon Jun 18 '10 at 17:19

Your Answer

 
discard

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.