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.

My Website is on a remote server, and on my computer, which is also being used as a server with xampp installed. Which files will the browser access if I just type www.mydomain.com in the address bar? The domain name is pointed to the remote server, but xampp is also configured with the domain name.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Your browser will go to your remote machine if that's where the DNS record points to.

Even though you may have configured the same site as a virtual host on your local xampp install, your browser doesn't know that.

If however, you have edited your hosts file or similar, to point to you local IP if you will reach the local copy.

share|improve this answer
    
Yes, I have my hosts file to access mydomain.com in htdocs. –  Grafica Feb 13 '12 at 22:01
    
No I mean, if you are using a GNU/Linux style OS, have you edited /etc/hosts or on Windows C:\WINDOWS\system32\drivers\etc\hosts (or similar). If you have a manual entry in their point www.mydomain.com to your local IP then you will be pointing to your local machine. –  jwbensley Feb 13 '12 at 22:05
    
Yes, I have 127.0.0.1 mydomain.com in that file. So does that mean that everyone that types that domain name (the real one, not mydomain.com) in the browser will access files on my local machine? –  Grafica Feb 13 '12 at 22:09
    
No, everyone else in the world not on your computer, will access what ever you have publish in your DNS records with your DNS provider. You need to take a crash course in DNS; en.wikipedia.org/wiki/Domain_Name_System –  jwbensley Feb 13 '12 at 22:11
1  
If you really can't work out which is which; drop a comment into the HTML code of one copy of your site, either you local copy or the remote copy. Then open your browser and see if you see the comment when viewing the page source: w3schools.com/tags/tag_comment.asp –  jwbensley Feb 13 '12 at 22:17
add comment

This depends completely on name resolution - having the web server configured in one way or another will not influence the decision on where the request will go.

What this means in practice is that if you've configured your hosts file or your internal DNS to point that name to the local server, then it will get the request; otherwise, it will resolve the name in the public DNS hierarchy and send the request to the server there - which should be the remote server.

share|improve this answer
add comment

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.