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.

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

  1. 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.

  2. 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?

What are my options? Thanks in advance.

share|improve this question

migrated from stackoverflow.com Nov 2 '11 at 6:57

This question came from our site for professional and enthusiast programmers.

    
I answered this here, instead, since it's purely a server configuration question. –  Tim Post Nov 2 '11 at 7:04

1 Answer 1

up vote 1 down vote accepted

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.):

user.mydomain.com.        CNAME  mysite.dyndns.org

More on CNAME records can be found at Wikipedia.

share|improve this answer
    
thanks! This sounds promising. I'll give it a try. –  Sebastian Nov 2 '11 at 7:41
    
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. –  Sebastian Nov 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

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.