开发者

Wordpress + VMware CSS path problem

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 mak开发者_JAVA百科ing 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


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


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.


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?


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

http://www.wampserver.com/


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜