Andy F
Andy F

Reputation: 1517

Web Forwarding or CNAME Solution - Which is Correct?

I have recently done some website work for a charity. The site I have built has been hosted on my own domain, in a directory. The site's address is www.mydomain.com/newsite/

The organisation has purchased their own URL and would like that URL to point to my hosted site such that the user goes to www.Charity.org and is shown the content from www.mydomain.com/newsite/

I've partially achieved what I wanted to do by using a 302 redirect and a frame, which I set up through the control panel for www.Charity.org, however this has the disadvantage of never displaying anything other than www.Charity.org in the address bar.

Essentially I would like to "mask" the mydomain URL with the charity one, so that the folder structure is still visible to the end user. If they go to www.charity.org/events then that's what they should see in their browser, but the content should map to www.mydomain.com/newsite/events

I have explored CNAME and A NAME solutions but neither of these seem to allow me to point to a directory.

Is this even possible?

Upvotes: 2

Views: 9972

Answers (1)

user577898
user577898

Reputation: 213

The solution is A NAME record.
In DNS zone file of charity.org, create A NAME record of www (& @) to point to your server IP (where the website live).
On server, you'll have to set DocumentRoot for www.Charity.org host. DocumentRoot must be the directory in which default webpage (index.htm, index.php etc) live. Done!
Provide your web server details if you need further help about setting DocumentRoot.

This can also be done with CNAME, but it'll require more complex server side configurations. And, I don't recommend to use masked web forwarding because its not SEO friendly and universally compatible.

Upvotes: 3

Related Questions