I'm running MacOSX 10.11.4.
I'd like to have example.com point to my locally running apache server, but have www.example.com point to the actual website.
Example:
I have the following entry in my /etc/hosts file:
127.0.0.1 example.com
If I ping example.com and www.example.com, they both hit 127.0.0.1 (I believe because the canonical URL is recognized as being the same).
Interesting note, Chrome will pull the URL's as I want, but Firefox will hit localhost for both.
-
Edit: I know that using something like example.local is more conventional and avoids this problem entirely; however, my work has been using the www/non-www method for a while now and would like to keep it, if possible.