iwonder — 2008-12-14T00:05:37-05:00 — #1
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 .)
captaincarne — 2008-12-14T09:57:39-05:00 — #2
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" />
bluestartech — 2008-12-14T10:04:37-05:00 — #3
you can just change the tcp/ip address in your network settings
felgall — 2008-12-14T13:48:37-05:00 — #4
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.
iwonder — 2008-12-16T09:20:39-05:00 — #5
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.
g_schuster — 2008-12-16T09:45:28-05:00 — #6
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
captaincarne — 2008-12-16T11:24:16-05:00 — #7
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.
logic_earth — 2008-12-17T11:48:35-05:00 — #8
C:\Windows\System32\drivers\etc Open the "hosts" file change the IP address located in front of "localhost" save, done.