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 have only an A record for a domain (the nameserver is somewhere else but they pass me an A record) and I want to point it off my server to a url such as www.example.com/mypage.

Is that possible? If so, how?

share|improve this question

closed as off topic by Chris S, John Gardeniers, Ward, MadHatter, Shane Madden Dec 16 '12 at 18:45

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

up vote 1 down vote accepted

The A record will only be able to point to www.example.com or even mypage.example.com, but not www.example.com/mypage.

share|improve this answer
    
Is it possible to mess about with CNAME to do this? –  Owen Jul 5 '11 at 17:53
    
Well, I'm trying to get your end-goal straight. You have a domain (yourdomain.com) and you want any requests for "yourdomain.com" to be sent to www.example.com/mypage? –  Safado Jul 5 '11 at 17:56
    
I have www.mydomain.com and I want it sent to www.example.com/mypage –  Owen Jul 5 '11 at 18:01
    
DNS is not (by default) capable of this. Alternately, you could CNAME to mypage.www.example.com, but not the HTTP path. –  Greeblesnort Jul 5 '11 at 18:05
    
Ok. As others have said, DNS isn't where you'll find your answer here. Mostly likely a redirect on your webserver is what you need. However, some registrars have domain forwards that you can put in place that might do what you're looking for. IF you're running apache, Michael Lowman's answer is the way to go. –  Safado Jul 5 '11 at 18:34

You can't point DNS to a URL. You can create an A record for the host server but you'll need to do the URL redirection on your web server.

As others have stated, the A record could point to mypage.mydomain.com or to www.mydomain.com or to mydomain.com but it can't point to www.mydomain.com/mypage

share|improve this answer
    
+1 The one and only answer to clearly state that DNS is not capable of redirecting URL paths. And further clearly stating that the redirection has to be done at the web server. (Though an A Record can't point to a subdomain, I'm sure you meant CNAME; the questioner is likely not familiar with the difference anyway). –  Chris S Jul 5 '11 at 19:11
    
@Chris S: Can you clarify? mypage and/or www could both be created as A records in the mydomain.com zone, pointing to the appropriate ip address of the host. –  joeqwerty Jul 5 '11 at 19:29
    
right, but you can't create an A Record a.example.com that points to b.example.com. I was just noting that your answer could be misread to imply that; especially by someone who doesn't really understand how DNS works. –  Chris S Jul 5 '11 at 21:59
    
@Chris S: Gotcha. Thanks much. –  joeqwerty Jul 5 '11 at 23:05

I believe you're asking if you can, given only the ability to specify the domain name of your host, force a redirect to a particular page on a separate server.

You could do this by running a redirect on your server. Use Apache and mod_rewrite. The docs show you could use the following in your Apache conf:

RewriteEngine On
RewriteRule /.* http://www.example.com/mypage [R]

P.S. In this case the A record is irrelevant. Specify whatever you want. You may have been thinking of CNAME records, I'm not sure; you might want to look them up. In any case, CNAME records and everything else in DNS are only for the part before the /. You would still need a redirect for anything other than the server name.

share|improve this answer
    
As @Ryan said, this is only if you run Apache. But you'll need to run some sort of webserver. Most should allow you to do redirects. (I'll be the first to admit Apache is overkill for this, but it also happens to have the module to do precisely this rewrite. And there are enough docs and tutorials about mod_rewrite to choke a horse.) –  Michael Lowman Jul 5 '11 at 18:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.