I need to change the localhost to a IP address in Windows XP. i.e when I open localhost/ it should display content of the IP but the name/url should be localhost.
The thing is, I am using a virtual machine, Parallels Desktop, on mac to run windows. So to access the mac localhost on xp, I have to go to a IP address, but when I do, although it displays the page of the mac localhost, all the stylesheet and image links are still localhost/url so only text is shown, the rest leads to a 404 page.
i.e If I go to the IP which has this html page. The content is like this
<link rel="stylesheet" type="text/css" href="localhost/url/style.css" />
The stylesheet does not open as it is from localhost/ url.
(Hope this is the right forum .)
Which OS is running your web site? Mac or XP?
It sounds like you are trying to test your site from your XP VM and your Mac has the files for your site. If so, you may need to create a Shard Folder (VMware has this, not sure if Parallels does) to access the files. You shouldn't need a reference to the hostname.
<link rel="stylesheet" type="text/css" href="url/style.css" />
you can just change the tcp/ip address in your network settings
localhost is pre-defined to point to 127.0.0.1 so if you need to point to a different ip address then you can't use localhost.
I need to run the php files which are connected to a mysql all working on localhost (of Mac OSx ) and access it from the windows virtual machine on its localhost url . The whole point is to test the script/design on Internet Explorer.
Seems as if you can not change localhost but you could use relative links in your scripts.
<link rel="stylesheet" type="text/css" href="localhost/url/style.css"/>
Well...this is wrong in all cases.
Either reference it as real URL (http://the.real.ip/url/style.css) or just as relative URL (/url/style.css).
The latter should work fine as when you browse the site by the IP the browser automatically extends it to http://the.current.ip/url/style.css
You will need to access the site from your XP VM with the IP address of your Mac.
Mac = 192.168.1.1
XP = 192.168.1.2
Use http://192.168.1.1 to access the web server on your Mac from your XP VM.
C:\Windows\System32\drivers\etc Open the "hosts" file change the IP address located in front of "localhost" save, done.
This topic is now closed. New replies are no longer allowed.