I'm overwhelmed by the many choices one has in website design. I'm probalbly asking something really easy to set up, but since I don't have any experience, I'm looking for help.

Current Setup

I've got a domain mydomain.com and ftp access to it. The apache webserver has mod_rewrite and perl installed (if that helps). I set up a subdomain user.mydomain.com that is currently pointing to the http://www.mydomain.com/user directory.

I've created a draft website running in the werc framework on a different linux machine. This server has no domain name, I can access it using the static IP or mywebsite.dyndns.org. werc supports virtual hosting, but I don't quite understand it and know if it helps me here. I'm running lighttp (w/ vhost and mod_rewrite) and have full root permission, so anything is possible on this end.

Problem

I would like to run the werc site inside the subdomain user.mydomain.com. The URL in the browser should be user.mydomain.com, i.e. no apparent redirecting to the actual werc server IP should take place.

What's the best way to achieve that? I tried mod_rewrite on the mydomain.com machine, but I could only redirect. I think one could use a seperate "frame" for the werc hosted site, but that feels a little unclean. E.g. what would happen to the <title> tag?

1 Answer
1

You should be able to solve this by adding a CNAME record for the sub domain user.mydomain.com with your DNS provider (or local name server, whichever you are using).

A CNAME says "This user.mydomain.com is just an alias for mywebsite.dyndns.org.

Then, name your virtual host on the subdomain server user.mydomain.com, and you won't have to go through any kind of redirection or re-write rules for it to work.

I'm not sure where you host DNS for mydomain.com, but almost every provider out there lets you setup a CNAME record through the control panel. If you are locally hosting DNS (e.g. BIND on the Linux box), add this to the zone file for mydomain.com (e.g.):

OK, I just learnt that this provider doesn't allow CNAME records for other servers, only for directories on that server. sucks... I guess I have to live with redirect then? anyway, answer was very helpful -- accepted.
–
SebastianNov 2 '11 at 14:11

There are some excellent free DNS hosting providers that give you full access to your zone records. It would probably be worth it to investigate some for the future, as being able to add a quick work around (like this one) will really speed up your work. Some hosting compaies / registrars are just morons, unfortunately.
–
Tim Post♦Nov 3 '11 at 1:16