I want to forward a url so that if you type http://www.example.com in the address bar, you are forwarded to http://www.test.com/test.php.
What I have done is added a cname record to my zone file.
So I have:
www IN CNAME www.test.com/test.php.
This isn’t getting the job done.
I have read quite a bit and am still having trouble grasping how the whole dns process works. My understanding is that a CNAME will just cause your domain to use another domains zone file. If this is the case, then a CNAME wouldn’t be what I am looking for.
If anybody could point me in the right direction, or give me a brief overview of the process in url forwarding, it would be greatly appreciated.
Thanks
You confuse DNS with URL forwarding. All you may have in a zone file is
www.test.comis a domain name,www.test.com/test.phpis a URL.having this CNAME have exactly same effect as having an “A” record for http://www.example.com pointing to the same IP address as http://www.test.com – youyr browser will first look at this CNAME, then get an IP address for http://www.example.com, then browser will send to that IP address, HTTP request for http://www.example.com (!).
URL forwarding done on a webserver, on http://www.test.com webserver you may define a virtual host http://www.example.com (NOT http://www.test.com), which may run your test.php or redirect from / to /test.php.
Or on http://www.example.com webserver you may setup a HTTP 303 redirect from http://www.example.com to http://www.test.com/test.php and then you don’t use a CNAME.
Though somewhat unordered but hope it helps.