views:

309

answers:

5

I posted a similar question earlier today but this question is clearer.

I want to locally develop my Wordpress websites (on my Mac) and test them in Internet Explorer (6,7,8) on Windows XP.

I can get the MAMP welcome screen to show in Windows XP, so I know VMWare is doing it's thing.

The local URL for my site (on my Mac) is:
URL (http://d3creative:8888/)

But the local URL under VMware/Internet Explorer is:
URL (http://192.168.2.1:8888/d3creative/)

This is the only way I can get it to show up, problem is all the CSS styles are referencing the local Mac URL (http://d3creative:8888/)

So understandably the CSS isn't showing up.

Is there a way to tell Windows that "http://192.168.2.1:8888/d3creative/" should equal "http://d3creative:8888/"

I've tried editing the "hosts" file within in Windows XP and I've rebooted after making any changes, but nothing is working.

My software:

  • MAMP Pro (v1.8.2)
  • Wordpress (v2.8.6)
  • Windows XP (SP3)
  • Internet Explorer (6, 7, 8)

Any help would be much appreciated.
Stephen Meehan

A: 

From your description, you have the site hosted on a Mac which is also running a virtual machine with Windows on it and when you try to access your site on the Mac from Internet Explorer in the VM you get no css but do you get the css fine if you point Safari on the Mac back at itself?

I would view the source of the Wordpress page in IE and check that the url for the css file is relative to the root of the website and not pointing directly at a filename in the OSX directory tree.

But without knowing what is actually in the rendered source code in the browser, it seems hard to think of what the problem might be.

Neil Trodden
Hi NeilThanks for taking a look at this.The problem is on the Mac the local URL is:http://d3creative:8888/But on the VMware/Internet Explorer it the local URL is:http://192.168.2.1:8888/d3creative/I can see the problem, the VM can't pick up the CSS styles because the URL is different.I need a way to tell the VM that "http://192.168.2.1:8888/d3creative/" is the same as "http://d3creative:8888/"I've had a look at the hosts file on the VM windows:C:\Windows\system32\drivers\etc\hostsBut I can't seem to get it to work...Hope you can help.Stephen
Stephen Meehan
A: 

The hosts file is certainly the first way to go (and should work for translating the host name into the IP no problem) but the problem in your case is that you need to serve different directory levels. Why is that in the first place? It can certainly be solved with mod_rewrite but it's awfully cumbersome.

Can't you address the whole site with http://d3creative? Won't that solve the hierarchy problem?

Pekka
A: 

Im not much of a techie, but cant you just use wamp on the xp side?

http://www.wampserver.com/

Greenie
A: 

You're going the wrong way with the hosts file -- instead of trying to get your browser to treat 192.168.2.1 as d3creative, putting the entry in your hosts file will allow the machine to resolve d3creative -- visit http://d3creative in your Windows browser.

HTTP works by first resolving the host name to an IP address, if required, then by passing the host name (or IP address, if no host name was given) when it connects to that IP address. The hosts file looks after extra mappings between names and IP addresses, it doesn't have anything to do with what the browser will pass to the server once the connection has been made, while the server will decide which locally-hosted site to return based on what the browser tells it after the connection has been made.

Andrew Aylett
+1  A: 

Hi

Thanks for everyone for taking a look at this, after much head scratching I have arrived at a solution!

Here's how I did it. hope this helps anyone else with the same problem. I'll be posting a video walk though for this at the end of next week on my website.

MAC OS
Open terminal to find your Mac IP address type: ifconfig in terminal Scroll down until you see "vmnet1" Look for the word "inet" next to this is the IP address you need Make a note of this as you will need it when you modify the "hosts" file in Windows XP Close Terminal

VMWare:
Set network adapter to "host-only" and make sure it is connected. Add your MAC Address in the Advanced options field (Your Mac address can be found in the system preferences under network) Close the window and it will ask you to apply changes, say yes.

Windows XP
Open the hosts file (c:\windows\system32\drivers\etc\hosts) Use notepad

You should see:
127.0.0.1 localhost

Under this enter the Mac IP address you got from Terminal followed by the name of your local site - in this case the site name is "newdemo". The site is determined by the Server name you set in MAMP Pro
Your Mac IP Address newdemo

Your hosts file should now look like this:
127.0.0.1 localhost Your Mac IP Address newdemo #change this to the Server name you set in MAMP

Command prompt (Windows)
Open command prompt (start button > run > type in CMD) Type ipconfig/flushdns

Now when you visit http://newdemo:8888/ you will see your local site in Internet Explorer!

Good luck! Stephen Meehan

Stephen Meehan