I just got a virtual host setup on my local machine for the first time, and I am experiencing weird URL/linking behavior. Here is my config: host file httpd-vhosts.conf Here are my issues/questions: 1) So when I go to preview.mysite.com, I see my local website (C:\xampp\htdocs\mysite). It appears that my style sheet is a little tweaked, some fonts appear bigger and some of the layout divs for the body and footer are shorter in height than they should be. The files on the live server are identical to the files locally, but the local styles are tweaked a little. 2) When I click on the 'About Us' link in the nav, the URL changes from "preview.mysite.com" to "http://localhost/about.php". Why isnt it changing to "preview.mysite.com/about.php"? 3) In another example (probably related to #2 above), if I go to the URL "http://localhost", it resolves to my site root directory (C:\xampp\htdocs\mysite\index.php). This cant be correct? 4) Any link or image that references the root directory like <a href="/about.php">About Us</a> works fine. Any link or image that references the "this" directory like <a href="./about.php">About Us</a> breaks and tries to resolve to "http://localhost/mysite/about.php" but its a broken page. It definitely seems like all these issues are related to the URL resolving to "localhost" instead of "preview.mysite.com". Can anyone offer any advice? This is the first time setting this up...
you need <VirtualHost preview.mysite.com:80> etc Code (markup): using * for the Vhost means it will listen for requests on all domains/ips. well, it's not as simple as that i think, but you get the idea.