简体   繁体   English

WordPress网站在本地服务器以外的设备上呈现的方式有所不同

[英]Wordpress website renders differently on devices apart from the local server

I am using my laptop as a test environment for a wordpress website before I move it to an online server. 在将笔记本电脑移至在线服务器之前,我将其用作Wordpress网站的测试环境。 I have this setup with a xampp sever running on the local machine. 我在本地计算机上运行的xampp服务器具有此设置。 Wordpress is installed and running a theme which I have modified somewhat. 已安装Wordpress并运行我已对其进行一些修改的主题。 When I navigate to the website from the local machine by going to 'localhost', the website displays correctly, however if I navigate to the website from another device whether it may be a computer, phone or tablet, the website seems to exclude css styling and only displays plain html. 当我从本地计算机通过转到“本地主机”导航到该网站时,该网站正确显示,但是,如果我从另一台设备导航到该网站(无论是计算机,电话还是平板电脑),则该网站似乎不包含CSS样式并且仅显示纯html。 Any insights would be appreciated. 任何见解将不胜感激。

I know that with some browsers, sites in your local intranet except localhost are rendered differently. 我知道在某些浏览器中,本地网络中除localhost外的网站呈现的方式有所不同。 I am not sure whether this is the issue here. 我不确定这是否是这里的问题。 I am using Chrome Version 42.0.2311.135 dev-m 我正在使用Chrome版本42.0.2311.135 dev-m

When you're accessing the site on another machine, open up the developer tools in your browser and see where the link to your CSS is pointing at. 当您访问另一台计算机上的站点时,请在浏览器中打开开发人员工具,然后查看指向CSS链接的位置。

It sounds like that CSS URL is hard-coded to be pointing at localhost (which would explain why it only works on your machine). 听起来CSS URL被硬编码为指向localhost(这将解释为什么它仅在您的计算机上起作用)。 It could also be the case that you have set your site's domain to be localhost in Wordpress which may be using that to render the URLs. 也可能是您在Wordpress中将站点的域设置为localhost,而该域可能正在使用该域来呈现URL。

Double check your Wordpress settings, and also your theme's code. 仔细检查您的Wordpress设置,以及主题代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM