我的图像在一台服务器上工作,但是在另一台服务器上不工作,我不知道发生了什么。

两台服务器上的style.css路径中的图像都按以下设置。我已经检查过了。

.category{ background:url(../images/category-icon.png); background-size:100%;}
.tabs a:hover .category{ background:url(../images/category_dark-icon.png); background-size:100%;}


但是在服务器1上,它可以工作,并且url变成这样。有用。

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/images/category-icon.png


但是在服务器2上是这样的。这是行不通的。

http://demo.server2.com/projects/gamingcafe/wp-content/themes/images/category-icon.png


我的目录样式在两台服务器上都是这样。

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/css/

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/images/

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/js/

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/less/


server2上的样式相同。

最佳答案

它最有可能与style.css文件所在的位置有关。

在server1上,style.css文件位于主题目录的根目录中还是位于子目录中?

07-24 17:07